In the movie Ex Machina, Caleb (played by Domhnall Gleeson) secretly writes some code into Nathan's (his boss) system to sabotage his work.
You can see the code, which is written in Python 2.7, for a brief moment:
Let's ignore the horrendous indentations after the function definitions and see, what the code does. Writing the code (here in Python 3.6) yields:
#BlueBook code decryption
import sys
def sieve(n):
# Compute the primes using sieve of Eratosthemes
x = [1] * n
x[1] = 0
for i in range(2, n//2): # has to be // in Python 3.x to get integer division
j = 2 * i
while j < n:
x[j] = 0
j = j + i
return x
def prime(n,x):
# Find nth prime
i = 1
j = 1
while j <= n:
if x[i] == 1:
j = j + 1
i = i + 1
return i - 1
# Compute BlueBook unlock code
x = sieve(10000)
code = [1206, 301, 384, 5]
key = [1, 1, 2, 2]
sys.stdout.write("".join(chr(i) for i in [73, 83, 66, 78, 32, 61, 32]))
for i in range(0, 4):
sys.stdout.write(str(prime(code[i],x) - key[i]))
print()
ISBN = 9780199226559
First off, the sieve of Eratosthemes is an old algorithm for finding prime numbers up to a given end number. You list all numbers from 2 onward until that end number. Then you strike out 2 and every second number thereafter. Then you proceed to the 3 and remove every third number thereafter. And so on, and so on until you cannot remove any more numbers...:
(source Wikipedia)
The result of the code above is an ISBN Number, referring to the book Embodiment and the inner life by Murray Shanahan, Professor of Cognitive Robotics at the Imperial College London. So, the "sabotage" code is actually a nice Easter Egg and homage.