Cube is a horror movie directed by Vincenzo Natali and released in 1997. The film was inspired by an episode of the popular television series of the end fifties and the sixties, The twilight zone. The episode in question, issued on December 15, 1961, was titled Five characters in search of an exit, a title which in turn was inspired by Pirandello’s play Six Characters in Search of an Author. This is the summary of Cube’s plot:
Six persons find themselves inexplicably in an unfamiliar place, consisting of cubic spaces connected together. As they explore, they discover that there are 17,576 spaces, which together form a larger cube, 26 small cubes per side; that each space is numbered with three three-digit numbers; and that some of the cubes (those where at least one of the numbers is prime or a power of a prime) contain deadly traps, while the cubes marked only with composite numbers (the product of different primes) are safe. Before being transferred to the cube (we never learn how) the five characters were engaged in different activities: a policeman, a crook specialized in escapes, a doctor, a math student, an autistic genius and the architect of the cube. The autistic boy has the amazing ability to decompose numbers into their prime factors, which helps them make sure that cells are safe. The math student says that breaking a number into its prime factors is very difficult. In the end, only the autistic boy gets out of the cube alive.
Sometimes, in my classes, I posed my students the following problem:
What is the scientific mistake in Cube?
The mistake is obvious. In fact, it is indicated in bold italics in the summary of the film.
- Before entering each of the cells, the characters must discover if any of the three three-digit numbers in the entrance is a prime number or the power of a prime. Is this so difficult, as to require the presence of an autistic genius?
- Obviously the writer of Cube’s script knows something, but it is all wrong. He has no doubt heard about the RSA encryption algorithm, widely used for Internet security, which is based on the fact that it is much harder to break down a composite number into its prime factors, than multiplying the latter to get the first. This is true, for example, for numbers with 128 figures or more, those used in conventional cryptographic certificates, but it is not true for three-digit numbers, such as those in Cube.
- According to the rules of Cube, the three-digit numbers appearing in the cells are between 001 and 998. Therefore, there are 998 possible numbers. How many of them are primes or prime powers? 168 are primes; 25 more are powers of primes. The other 805 are composite. What is the probability that a cell is safe? The cube of the probability that a three-digit number will be a composite, i.e. (805/998)3 = 52.5%. Not bad: there is almost the same number of safe cells as cells with traps.
- To find whether a three-digit number is a prime, one must see that is not divisible by one of the following eleven numbers: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 and 31 (the prime numbers less than the square root of 999). Many of the composite numbers (over one half) can be detected at first sight; for others one needs to make a few simple mental calculations, quite easy for a math student (and for many who are not).
- The other dangerous numbers, the 25 prime powers, are the following:
- Eight powers of 2: 4, 8, 16, 32, 64, 128, 256 and 512.
- Five powers of 3: 9, 27, 81, 243 and 729.
- Three powers of 5: 25, 125 and 625.
- Two powers of 7: 49 and 343.
- Finally, the square of 11, 13, 17, 19, 23, 29 and 31: 121, 169, 289, 361, 529, 841 y 961.
Any math student knows by heart most of these numbers. The others are very easy to calculate mentally.
In conclusion, the math student in Cube should have been able to solve by herself the problem of whether the cells were safe or unsafe, without the need to introduce the autistic genius. This is the scientific mistake in the film.