# Number Theory

## Fermat's Theorem

Pierre de Fermat (1601-1665) is one of the most famous number theoreticians in history, but mathematics was only his hobby. He was a judge in France, and he published very little during his life. He did correspond extensively with many leading intellectuals of his day, and his mathematical innovations were presented to these pen pals in his letters.

One of Fermat's many theorems provides a quick way of finding out if a number is prime. Say n is any whole number, and p is any prime number. Raise n to the power of p, and then subtract n from the result. If p is really a prime number, then the result can be divided evenly by p. If anything is left over after the division, then the number p is not prime. A shorter way of putting this formula is this: np - n can be divided evenly by p.

Here is a simple illustration of Fermat's theorem. Let n = 8 and p = 3. If Fermat's theorem is right, then 83 - 8 must be divisible by 3. Multiply 8 by itself three times (8 × 8 × 8): the product is 512. Subtract 8 from 512: the result is 504. Divide 504 by 3: the result is 168. Fermat's theorem works for any whole numbers that meet the conditions of the formula.