Chapter I
Euclid's Primes
The same book that founded Euclidean geometry founded number theory. Books VII to IX of Euclid's Elements, often skipped by geometry students, are about whole numbers. They contain the algorithm for finding the greatest common divisor of two numbers, still taught and still used by computers, and a recipe for perfect numbers.
They also contain one of the most admired proofs ever written. Suppose there were only finitely many primes. Multiply them all together and add one. The result leaves remainder 1 when divided by every prime on the list, so its prime factors are not on the list. The list was incomplete. The primes never end.
Chapter II
Diophantus and the Margin
Five centuries later, Diophantus of Alexandria collected problems asking for solutions in whole numbers or fractions. His Arithmetica, partly lost, was translated into Latin in 1621. A copy reached Pierre de Fermat, a lawyer in Toulouse who did mathematics for pleasure.
Fermat filled its margins with claims. Beside a problem about writing a square as the sum of two squares, he noted around 1637 that no cube can be the sum of two cubes, nor any higher power the sum of two like powers, and that he had a marvellous proof that the margin was too narrow to contain. He never published it, and almost certainly did not have one. The claim, Fermat's Last Theorem, would drive number theory for 358 years.
Chapter III
Euler's Century
Leonhard Euler took Fermat's claims seriously and proved most of them: that leaves remainder 1 when divided by a prime (Fermat's little theorem), and that primes of the form are sums of two squares. He also found one claim false. In 1732 he showed that , which Fermat believed prime, is divisible by 641. Number theory stopped being a collection of confident guesses and became a subject of proofs.
Chapter IV
A Closer Look: Why Fermat's Little Theorem Is True
Fermat's little theorem says that if is prime and is not a multiple of , then leaves remainder 1 when divided by . Check it with and : . The remainder is 1, as promised. But why should it always work?
Work "modulo 7", keeping only remainders. Multiply each of the nonzero remainders by 3:
The results are : the same six numbers, shuffled. That is no accident. If two of them coincided, 7 would divide 3 times a number smaller than 7, which is impossible for a prime. So multiplying everything by 3 only permutes the list, and the product of the list is unchanged:
The left side is . Since shares no factor with 7, it can be cancelled, leaving . The same argument works for any prime and any .
That half-page argument, essentially Euler's, has three lives in this atlas. It is the germ of group theory: the nonzero remainders form a group, and the theorem is a case of Lagrange's theorem. It is the basis of fast primality tests: if , then is certainly not prime. And, generalised by Euler to non-prime moduli, it is exactly why RSA decryption undoes encryption.
Chapter V
Gauss Makes a Discipline
Carl Friedrich Gauss is said to have called mathematics the queen of the sciences and number theory the queen of mathematics. His Disquisitiones Arithmeticae (1801), written in his early twenties, organised the whole subject. It introduced the congruence notation and proved the law of quadratic reciprocity that Euler and Adrien-Marie Legendre had conjectured. He later gave several more proofs of that law.
After Gauss the subject split under the pressure of its hardest questions. How are the primes distributed? Calculus turned out to hold the answer, and that became analytic number theory. Why did every attempt on Fermat's theorem fail? Unique factorisation breaks down in larger number systems, and repairing it became algebraic number theory. And in the 1970s, Fermat's little theorem turned out to be exactly what was needed to build public-key cryptography.