Alan Turing's exploits in code-breaking, philosophy, artificial intelligence and the foundations of computer science are by now well known to many. Less well known is that Turing was also interested in number theory, in particular the distribution of prime numbers and the Riemann hypothesis. These interests culminated in two programs that he implemented on the Manchester Mark 1 (see Figure 3.1), the first stored-program digital computer, during its 18 months of operation in 1949–1950. Turing's efforts in this area were modest, and one should be careful not to overstate their influence. However, one cannot help but see in these investigations the beginning of the field of computational number theory, bearing a close resemblance to active problems in the field today despite a gap of 60 years. We can also perceive, in hindsight, some striking connections to Turing's other areas of interests, in ways that might have seemed far-fetched in his day. This chapter will attempt to explain the two problems in detail, including their early history, Turing's contributions, some developments since the 1950s, and speculation for the future.
People have been interested in prime numbers since at least the ancient Greeks. Euclid recorded a proof that there are infinitely many of them around 300 BC (Narkiewicz, 2000, §1.1.2). His proof, still one of the most elegant in all mathematics, can be expressed as an algorithm:
Write down some prime numbers.
Multiply them together and add 1; call the result n.
Find a prime factor of n.
For instance, if we know that 2, 5 and 11 are all prime then, applying the algorithm with these numbers, we get n = 2× 5× 11+1 = 111, which is divisible by the prime 3. By an earlier theorem in Euclid's Elements, the number n computed in step (2) must have a prime factor (and in fact it can be factored uniquely into a product of primes by the Fundamental Theorem of Arithmetic), so step (3) is always possible. On the other hand, from the way that Euclid constructs the number n, the prime factor found in step (3) cannot be any prime written down in step (1). Thus, no list of primes can be complete, i.e. there are infinitely many of them.