30.12.2013 Views

Fermat & his Little Theorem

Fermat & his Little Theorem

Fermat & his Little Theorem

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

79<br />

<br />

<strong>Fermat</strong> & <strong>his</strong> <strong>Little</strong> <strong>Theorem</strong><br />

We have seen that our subject has a long <strong>his</strong>tory and tradition in many cultures and<br />

countries. But if we consider our culture as part of the culture born out of the<br />

Renaissance, then one of the people most responsible for bringing up our subject in our<br />

culture is Pierre de <strong>Fermat</strong>, the great 17 th century French mathematician whose name we<br />

encountered in the first section. In t<strong>his</strong> section we will discuss what is known as <strong>Fermat</strong>’s<br />

<strong>Little</strong> <strong>Theorem</strong>, a very useful fact and one that leads in many ways to the birth of abstract<br />

algebra later on. Before we prove it we need to investigate something interesting and<br />

entertaining.<br />

Let us recall the basic properties of the binomial coefficients:<br />

n<br />

k<br />

, which reads, n<br />

choose k , is the number of ways of choosing k objects out of a total of n objects, and it<br />

is referred to as a binomial coefficient since:<br />

n<br />

n n n<br />

2<br />

n<br />

n 2<br />

n<br />

n 1<br />

n<br />

n<br />

(1 x)<br />

x x x x x .<br />

0 1 2 n 2 n 1 n<br />

The first 12 powers are given by:<br />

1<br />

(1 x) 1 x<br />

2 2<br />

(1 x) 1 2x x<br />

3 2 3<br />

(1 x) 1 3x 3x x<br />

4 2 3 4<br />

(1 x) 1 4x 6x 4x x<br />

5 2 3 4 5<br />

(1 x) 1 5x 10x 10x 5x x<br />

6 2 3 4 5 6<br />

(1 x) 1 6x 15x 20x 15x 6x x<br />

7 2 3 4 5 6 7<br />

(1 x) 1 7x 21x 35x 35x 21x 7x x<br />

8 2 3 4 5 6 7 8<br />

(1 x) 1 8x 28x 56x 70x 56x 28x 8x x<br />

9 2 3 4 5 6 7 8 9<br />

(1 x) 1 9x 36x 84x 126x 126x 84x 36x 9x x<br />

10 2 3 4 5 6 7 8 9 10<br />

(1 x) 1 10x 45x 120x 210x 252x 210x 120x 45x 10x x<br />

11 2 3 4 5 6 7 8 9 10 11<br />

(1 x) 1 11x 55x 165x 330x 462x 462x 330x 165x 55x 11x x<br />

12 2 3 4 5 6 7 8 9 10 11 12<br />

(1 x) 1 12x 66x 220x 496x 792x 924x 792x 495x 220x 66x 12x x<br />

The following are basic facts:<br />

n<br />

0<br />

n<br />

n<br />

1, and<br />

n<br />

k<br />

n<br />

n k .<br />

They also satisfy Pascal’s Recursion:<br />

n<br />

k<br />

1<br />

n<br />

k<br />

k<br />

n<br />

1


80<br />

and are explicitly given by Newton’s Formula:<br />

n n!<br />

n( n 1)( n 2) ( n k 1)<br />

.<br />

k k!( n k)!<br />

k( k 1)( k 2) 1<br />

Suppose now we look at the expansion of 1<br />

n<br />

x mod n :<br />

1<br />

(1 x ) 0<br />

mod 1<br />

2 2<br />

(1 x) 1 x mod 2<br />

3 3<br />

(1 x) 1 x mod 3<br />

4 2 4<br />

(1 x) 1 2x x mod 4<br />

5 5<br />

(1 x) 1 x mod 5<br />

6 2 3 4 6<br />

(1 x) 1 3x 2x 3x x mod 6<br />

7 7<br />

(1 x) 1 x mod 7<br />

8 2 4 6 8<br />

(1 x) 1 4x 6x 4x x mod 8<br />

9 3 6 9<br />

(1 x) 1 3x 3x x mod 9<br />

10 2 5 8 10<br />

(1 x) 1 5x 2x 5x x mod 10<br />

11 11<br />

(1 x) 1 x mod 11<br />

12 2 3 4 8 9 10 12<br />

(1 x) 1 6x 4x 4x 4x 4x 6x x mod 12<br />

We could venture a conjecture in that the only exponents that have a nonzero<br />

coefficient are NOT relatively prime to n .<br />

Indeed,<br />

n<br />

Lemma. For any n and k , 0<br />

k<br />

n<br />

then 0<br />

k<br />

mod n .<br />

Proof. From Newton’s Formula, we get that<br />

so<br />

k<br />

n<br />

k<br />

n<br />

n<br />

k<br />

1<br />

1<br />

mod<br />

n<br />

k<br />

n<br />

n k<br />

. In particular, if n k 1 ,<br />

n! n ( n 1)! n<br />

k!( n k)! k ( k 1)!( n k)!<br />

k<br />

n<br />

, so k 0 mod n . But then we are done by cancellation. <br />

k<br />

n<br />

k<br />

1<br />

1<br />

,<br />

12<br />

Note that the converse of t<strong>his</strong> lemma is not true: 0<br />

6<br />

We could now venture another guess: that (1<br />

n<br />

x) 1<br />

that is exactly the theorem we prove now.<br />

mod 12.<br />

n<br />

x exactly when n is prime, and


81<br />

<strong>Theorem</strong>. Primeness. Let n 1. Then n is a prime number if and only if<br />

n<br />

n<br />

(1 x) 1 x mod n .<br />

Proof. One direction is clear from the previous lemma: if n is prime, then any<br />

k 1, , n 1 is relatively prime to n, and so we have our conclusion. Assume now that<br />

n is not prime. Let p be the smallest prime dividing n , so p n and ( p 1)! is<br />

n n<br />

relatively prime to n. We claim 0 mod n . T<strong>his</strong> follows from:<br />

p p<br />

n<br />

=<br />

n( n 1)( n 2) ( n p 1)<br />

,<br />

p p( p 1)( p 2) 1<br />

and so mod n , we have<br />

( p 1)! n n<br />

( n<br />

p p<br />

1)( n 2) ( n p 1) ,<br />

but then mod n, we have<br />

( p 1)!<br />

n n n 1<br />

( 1)( 2) ( p 1) ( 1) ( p<br />

p p p<br />

1)! ,<br />

and we can cancel the ( p 1)! since it is relatively prime to n, and we have arrived at<br />

n<br />

n<br />

p<br />

( 1) 1<br />

1<br />

( 1) p mod p p n . If p is odd, then 1<br />

and thus we are finished.<br />

, and if p 2 , then<br />

n<br />

2<br />

n<br />

2<br />

mod n<br />

<br />

10<br />

Example 1. 45 5<br />

2<br />

35<br />

324,632 7 mod 35.<br />

5<br />

12<br />

mod 10, 66 6<br />

2<br />

15<br />

mod 12, 455 5<br />

3<br />

mod 15 and<br />

And we are ready for a fundamental theorem:<br />

<strong>Theorem</strong>. <strong>Fermat</strong>'s <strong>Little</strong> <strong>Theorem</strong>. Let p be a prime. Then the<br />

following are true:<br />

p<br />

For any m , m m mod p .<br />

p 1<br />

If m is relatively prime to p , then m 1 mod p .<br />

Proof. We start by proving that the two statements are equivalent: If is true, and m is<br />

relatively prime to p , then by cancellation, follows. Conversely, assume . Then by<br />

simply multiplying we get when m is relatively prime p . And if m is not relatively<br />

prime to p , then m 0 and so m p m mod p is trivial. We proceed to prove ,<br />

namely<br />

p<br />

m m mod p by induction on m . If m 1, it is obvious. Suppose the theorem<br />

holds for m , so<br />

p<br />

m m mod p . We now have to show that it holds for m 1, that is,<br />

p<br />

we have to prove that mod p , ( m 1) m 1 . But by the previous theorem and by<br />

p p<br />

induction, we get: ( m 1) m 1 m 1, and we are done.


82<br />

Example 2. Let us consider p 7 , then since<br />

every m is congruent to a standard residue, we<br />

only need to consider those.<br />

Example 3. On the Number 341 Again.<br />

30<br />

2 1073741824 1 mod 31. But actually<br />

5<br />

2 32 1 mod 31, so although we know one power (namely p 1) that will give 1, it<br />

may not be the smallest power. We will pursue t<strong>his</strong> smallest power below. Once<br />

5<br />

10 5 2 2<br />

2 1 mod 31, then, of course, 2 (2 ) 1 1 mod 31. By the theorem,<br />

10<br />

10<br />

2 1 mod 11, and so since 11 and 31 are relatively prime, 2 1 mod 341, and so<br />

341 10 34<br />

2 (2 ) 2 2 mod341 , a fact we encountered in a previous section, except now we<br />

can argue it with almost no computational aides.<br />

One can wonder whether the property of the theorem characterizes primes. In other<br />

p<br />

words, suppose m m mod p for all m , is then p necessarily a prime? Or in the other<br />

version, if whenever m and p are relatively prime, we have that<br />

then necessarily a prime?<br />

p 1<br />

m 1 mod p , is p<br />

Example 4. On the Number 561, a Pseudoprime. Let us consider a very special<br />

number: p 561 3 11 17 . If we take an m relatively prime to 561, then we know<br />

2<br />

10<br />

16<br />

that m 1 mod 3, m 1 mod 11 m 1 mod 17 since we can apply the theorem to<br />

the three primes, and so we have that<br />

560 2 280<br />

560 10 56<br />

560 16 35<br />

m ( m ) 1 mod 3, m ( m ) 1 mod 11 and m ( m ) 1 mod 17,<br />

thus<br />

560<br />

m 1 mod 561, so holds for 561. But how about ?<br />

m m 7 mod( m 7 ,7) m 6 mod( m<br />

6 ,7)<br />

1 1 1 1 1<br />

2 128 2 64 1<br />

3 2187 3 729 1<br />

4 16384 4 4096 1<br />

5 78125 5 15625 1<br />

6 279936 6 46656 1<br />

Computing powers using the squaring algorithm from previously, we can see that mod<br />

561<br />

561, where the bolded columns are the ones relevant to the power 561, 3 3,<br />

561<br />

561<br />

11 11 and 17 17:<br />

1 2 4 8 16 32 64 128 256 512 561<br />

3 9 81 390 69 273 477 324 69 273 3<br />

11 121 55 220 154 154 154 154 154 154 11<br />

17 289 493 136 544 289 493 136 544 289 17<br />

e f g<br />

And thus if m is arbitrary, then m 3 11 17 k where k is relatively prime to 561, and<br />

the exponents e, f and g are nonnegative. Then mod 561,<br />

561 e 561 f 561 g 561 561 561 e 561 f 561 g 560 e f g<br />

m (3 ) (11 ) (17 ) k (3 ) (11 ) (17 ) k k 3 11 17 k m<br />

and thus <strong>Fermat</strong>’s <strong>Little</strong> <strong>Theorem</strong> also holds for 561. But 561 is not prime. So it is<br />

referred to as a pseudoprime. The existence of infinitely many such pseudoprimes was<br />

proven in 1992.


83<br />

Alas, 341 is not a pseudoprime since<br />

341<br />

3 168 mod 341.<br />

One of the reasons why statement of the theorem is more attractive is because it is<br />

more powerful algebraically—any power of 1 is also 1, and we used t<strong>his</strong> property several<br />

times in the argument above, for example claiming that since mod 17, m 16 1, m 560 1<br />

also. Euler and <strong>his</strong> successful pursuit of the generalization of <strong>Fermat</strong>’s <strong>Little</strong> <strong>Theorem</strong><br />

will be the topic of the next section, and it is statement that he will generalize.<br />

So the key idea becomes that of the smallest positive exponent that will make the<br />

power of a number equal to 1 in a given mod. T<strong>his</strong> smallest power is called the order<br />

of the number in that modulus.<br />

So <strong>Fermat</strong>’s <strong>Little</strong> <strong>Theorem</strong> claims that modulo a prime p , the order of anything<br />

(which is not a multiple of p ) is at most p 1. We will soon improve on t<strong>his</strong> once we<br />

understand order better.<br />

Example 5. On the Order of 2 mod 3, 5, 7, 9, 11 and 13. Let us consider the powers of<br />

2 in several different moduli:<br />

Exponent 1 2 3 4 5 6 7 8 9 10 11 12<br />

Power 2 4 8 16 32 64 128 256 512 1024 2048 4096<br />

mod 3 2 1 2 1 2 1 2 1 2 1 2 1<br />

mod 5 2 4 3 1 2 4 3 1 2 4 3 1<br />

mod 7 2 4 1 2 4 1 2 4 1 2 4 1<br />

mod 9 2 4 8 7 5 1 2 4 8 7 5 1<br />

mod 11 2 4 8 5 10 9 7 3 6 1 2 4<br />

mod 13 2 4 8 3 6 12 11 9 5 10 7 1<br />

So the order of 2 mod 3 is 2, mod 5 is 4, mod 7 is 3 (not 6), mod 9 is 6, mod 11 is 10 and<br />

mod 13, the order is 12. So the theorem predicted the order most of the time. It did not for<br />

3<br />

3 2 2<br />

7, but in any case 2 1, so (2 ) 1 1, so the theorem is satisfied. Mod 9 is not<br />

6<br />

12<br />

relevant because 9 is not a prime, but once we have 2 1, then certainly 2 1 also. Do<br />

1234<br />

10 1230<br />

1234 4<br />

we know 2 ? mod 11? Since 2 1, 2 1, so 2 2 16 5 mod 11.<br />

We should clarify that not everything has an order mod anything: for example mod 9,<br />

m<br />

3 0 for all m 2, or mod 12, the powers of 2 are, respectively, 2, 4, 8, 4, 8, … and so<br />

on, so not power of 2 will ever be 1.<br />

The next lemma explains it better.


84<br />

<strong>Theorem</strong>. Existence of Order. Let k be a positive integer. Then a has<br />

an order mod k if and only if they are relatively prime, a k 1.<br />

m<br />

Proof. Suppose a has an order mod k , so a 1 mod k for some positive integer m .<br />

m<br />

Let p be a common divisor of a and k . Then mod p , a 0 , but a 1, also, so p 1<br />

and we have a k 1. Conversely, suppose a and k are relatively prime. Since the<br />

2 3 4<br />

powers of a : a, a , a , a ,... go on indefinitely so two of them have to congruent mod k ,<br />

say for i j,<br />

a<br />

i<br />

j<br />

a mod k . Because of relative primeness, we can cancel a , so we get<br />

i 1 j 1<br />

i 2 j 2<br />

mod k , a a , and then a a , and so on until we obtain 1<br />

positive power of a is 1, and so order exists.<br />

j i<br />

a<br />

, so some<br />

<br />

Example 6. On the Order Mod 10. Thus mod<br />

10, only 1, 3, 7 and 9 will have an order.<br />

Indeed the table verifies that:<br />

Thus the order of 1 is 1 (always), the order of 3<br />

is 4, the order of 7 is 4 also and the order of 9<br />

is 2.<br />

By the fifth power we have a repetition in each<br />

row, so the table will just keep repeating.<br />

Exponent 1 2 3 4 5<br />

1 1 1 1 1 1<br />

2 2 4 8 6 2<br />

3 3 9 7 1 3<br />

4 4 6 4 6 4<br />

5 5 5 5 5 5<br />

6 6 6 6 6 6<br />

7 7 9 3 1 7<br />

8 8 4 2 6 8<br />

9 9 1 9 1 9<br />

Let us pursue properties of order further. Suppose for example, that, mod k , for some k ,<br />

m 44 1 and that m 43 1 also. Then without hesitation we can claim m 1, since<br />

44 43<br />

1 m m m m , all mod k .<br />

Suppose instead we had that m 44 1 and also m 32 1 (all t<strong>his</strong> mod k ). What can we<br />

44 32 12 12<br />

claim then? Easily, 1 m m m m and we conclude m 12 1. But t<strong>his</strong> is not the<br />

best conclusion we can make. Since 4 is the g.c.d. of 32 and 44, we know we can write it<br />

as a combination of them: 4 3 44 4 32, and so 3 44 4 4 32 , and thus<br />

44 3 4 4 32 4 32 4 4<br />

1 ( m ) m m ( m ) m , and we have a superior result. The superiority<br />

4<br />

stems from the fact that from m 1, we can readily conclude that m 12 1 easily—the<br />

cube of 1 is 1, but not the other way around—just because the cube is 1 does not mean<br />

the number is 1. In fact, we could not conclude that m 2 1 for the same reasons, since<br />

m 2<br />

4<br />

2<br />

1 is possible. E.g., 2 1 mod 5 and 2 1.<br />

Roughly a century and a half after <strong>Fermat</strong>, these ideas would be developed much further<br />

and gain much power in the hands of Lagrange, Gauss and Galois at the time abstract<br />

algebra is born.<br />

And we are ready with a fundamental fact about order.


85<br />

<strong>Theorem</strong>. Order. Let a be an integer. Let m, n,<br />

k be positive. If<br />

m<br />

a<br />

n<br />

1 mod k and a<br />

m n<br />

1 mod k , then also a 1 mod k .<br />

Proof. Without loss, by Kuttaka, if we let d m n, then we can assume there are<br />

positive integers rs , such that d rm sn , or equivalently d sn rm. But then mod<br />

k , of course,<br />

and the result is established.<br />

r m<br />

r<br />

d sn d sn d n<br />

s<br />

d s d<br />

1 1 a a a a a a a 1 a<br />

<br />

Corollary. Meaning of Order. Let a have order n modulo k . Then for<br />

m<br />

any m , a 1 mod k if and only if n|<br />

m.<br />

m n<br />

Proof. One direction is clear: if n|<br />

m, then mod k , we have<br />

n n<br />

a ( a ) 1 1.<br />

m<br />

m n<br />

Conversely, suppose a 1, but then a 1, and since n is smallest positive number<br />

for which t<strong>his</strong> happens, m n n and we are done. <br />

As a direct consequence of t<strong>his</strong> corollary and <strong>Fermat</strong>’s <strong>Little</strong> <strong>Theorem</strong>, we get<br />

Corollary. Order Mod a Prime. Let p be a prime and let m p 1. Then<br />

the order of m mod p is a divisor of p 1.<br />

Example 7. On the Order Mod 11. The order of anything mod 11 is thus a divisor of 10:<br />

Exponent 1 2 3 4 5 6 7 8 9 10<br />

1 1 1 1 1 1 1 1 1 1 1<br />

2 2 4 8 5 10 9 7 3 6 1<br />

3 3 9 5 4 1 3 9 5 4 1<br />

4 4 5 9 3 1 4 5 9 3 1<br />

5 5 3 4 9 1 5 3 4 9 1<br />

6 6 3 7 9 10 5 8 4 2 1<br />

7 7 5 2 3 10 4 6 9 8 1<br />

8 8 9 6 4 10 3 2 5 7 1<br />

9 9 4 3 5 1 9 4 3 5 1<br />

10 10 1 10 1 10 1 10 1 10 1<br />

so the respective orders of 1, 2, 3, 4, 5, 6, 7, 8 and 9 are: 1, 10, 5, 5, 5, 10, 10, 10, 5 and 2.<br />

m<br />

m<br />

For the remainder of the section we explore some classical results with our new found<br />

power based on the concept of order.<br />

Let a b 1 be relatively prime integers. Consider the sequence<br />

n n<br />

A ( , ) a b<br />

n<br />

a b An<br />

a b ,


86<br />

where we will use An<br />

( a, b ) for clarification when necessary.<br />

Some concrete examples follow:<br />

a b A<br />

1<br />

A<br />

2<br />

A<br />

3<br />

A<br />

4<br />

A<br />

5<br />

A<br />

6<br />

A<br />

7<br />

A<br />

8<br />

A<br />

9<br />

A<br />

10<br />

2 1 1 3 7 15 31 63 127 255 511 1023<br />

3 2 1 5 19 65 211 665 2059 6305 19171 58025<br />

4 3 1 7 37 175 781 3367 14197 58975 242461 989527<br />

5 2 1 7 39 203 1031 5187 25999 130123 650871 3254867<br />

5 3 1 8 49 272 1441 7448 37969 192032 966721 4853288<br />

6 1 1 7 43 259 1555 9331 55987 335923 2015539 12093235<br />

6 5 1 11 91 671 4651 31031 201811 1288991 8124571 50700551<br />

7 2 1 9 67 477 3355 23517 164683 1152909 8070619 56494845<br />

7 5 1 12 109 888 6841 51012 372709 2687088 19200241 136354812<br />

8 3 1 11 97 803 6505 52283 418993 3354131 26839609 214736555<br />

8 5 1 13 129 1157 9881 82173 673009 5462197 44088201 354658733<br />

9 2 1 11 103 935 8431 75911 683263 6149495 55345711 498111911<br />

9 5 1 14 151 1484 13981 128954 1176211 10664024 96366841 869254694<br />

9 7 1 16 193 2080 21121 206896 1979713 18640960 173533441 1602154576<br />

10 1 1 11 111 1111 11111 111111 1111111 11111111 111111111 1111111111<br />

10 3 1 13 139 1417 14251 142753 1428259 14284777 142854331 1428562993<br />

10 7 1 17 219 2533 27731 294117 3058819 31411733 319882131 3239174917<br />

Table of<br />

An<br />

s for various a s & b s<br />

As the table exhibits, the first claim we can make is that<br />

A is always an integer.<br />

n<br />

n n n n<br />

n n<br />

That is easy: mod a b, a b, so a b , so a b 0 , so ( a b) | ( a b ) and so<br />

A<br />

n<br />

is a (positive) integer. T<strong>his</strong> argument may look familiar, but it is both beautiful and<br />

useful so it is worth repeating. Also those among the readers that are algebraically<br />

1 2 3 2 2 1<br />

minded will readily recognize that A a n a n b a n b ab n b n .<br />

The next remark is as easy as the first one:<br />

if n|<br />

m, then A | A .<br />

Again, we do modular arithmetic: mod<br />

n<br />

n n<br />

a b ,<br />

n<br />

m<br />

m<br />

m<br />

n n m n<br />

a b , so ( ) n n n m<br />

( )<br />

m m<br />

so a b 0, and so by the Cancellation <strong>Theorem</strong>, mod<br />

A<br />

m<br />

m<br />

a<br />

a<br />

b<br />

b<br />

m<br />

0 .<br />

Next we need to show that<br />

a ( a b) 1 b ( a b ) and a A 1 b A .<br />

n<br />

a a b b ,<br />

n<br />

A<br />

n<br />

n n<br />

a b<br />

a b ,


87<br />

The first claims are immediate, since if for some mod prime p , a 0 and a b 0 ,<br />

then b 0 also, which is impossible; similarly for the second equality. Suppose now p<br />

n n n<br />

a b b<br />

is a prime and mod p , A<br />

n<br />

0 and a 0. But then An<br />

a b b<br />

necessarily b 0 which is impossible; ; similarly for the last equality.<br />

We are on our way to proving the following very elegant result<br />

<strong>Theorem</strong>. GCDs and<br />

Then for any ,<br />

b<br />

n 1<br />

A ' s. Let a b 1 be relatively prime integers.<br />

nm:<br />

n m n m<br />

n<br />

A A A .<br />

, and so<br />

Proof. Let d n m, then we know already by the previous discussion that A | A and<br />

Ad<br />

| A<br />

m. Now let q be a common divisor of A<br />

n<br />

and A<br />

m<br />

. But then we know that ( a b)<br />

q<br />

n n<br />

m m<br />

is a common divisor of a b and a b . We also know that since q and a are<br />

relatively prime, (and similarly for b ), hence a ( a b) q 1 b ( a b)<br />

q . Thus, mod<br />

( a b)<br />

q , we have that<br />

n<br />

n n a<br />

a b , so 1<br />

b<br />

m<br />

a<br />

, and similarly 1 , so by the Order<br />

b<br />

d<br />

a<br />

d d d d<br />

<strong>Theorem</strong>, 1. But then mod ( a b)<br />

q , we have a b , so a b 0, so by<br />

b<br />

Cancellation, A<br />

d<br />

0 mod q , and we are finished. <br />

Example 8. Let a 7 and b 2 . Then A<br />

6<br />

23517 and A<br />

9<br />

8070619 . And as readily<br />

verified by the Euclidean algorithm, A6 A9 67 A<br />

3<br />

. Similarly, if a 8 and b 5,<br />

then A<br />

10<br />

354658733 and A<br />

8<br />

5462197 and A10 A8 13 A<br />

2<br />

.<br />

The reader may suspect that the relative primeness of a and b was essential for t<strong>his</strong><br />

theorem, and indeed that is the case.<br />

d<br />

n<br />

Corollary. Primeness of<br />

A<br />

n<br />

. If<br />

A<br />

n<br />

is prime, then n is prime.<br />

Proof. If n has a proper prime divisor p , then A<br />

p<br />

1 is a proper divisor of A<br />

n<br />

.<br />

<br />

However, the converse is not true: e.g. if a 4 and b 3, then A<br />

5<br />

781 11 71. In<br />

fact, no one knows whether for any specific a and b , there is always a prime among the<br />

A ' s, or infinitely many primes, or whatever.<br />

n<br />

Some specific cases in the table are particularly interesting—we start with a very<br />

classical situation.


88<br />

Example 9. The Mersenne Primes. Let a 2 and b 1.<br />

Then 2 n<br />

A 1<br />

n<br />

and these are<br />

called the Mersenne Numbers after the cleric and letter writer of the 17 th century, a<br />

contemporary of <strong>Fermat</strong>—for <strong>his</strong>torical reasons, we will denote them by M .<br />

The primes among them are naturally the Mersenne Primes. As we saw above, if<br />

to be a prime, n has to be also. In fact,<br />

2<br />

3<br />

primes, but M 2047 23 89 is not prime.<br />

11<br />

M , 7<br />

M<br />

n<br />

is<br />

M , M 31 and M 127 are all<br />

And although one sees quite few Mersenne Primes in the table above, they are much<br />

scarcer than they seem at first.<br />

In fact, at present, there are only 47 known Mersenne Primes, those for the following<br />

exponents n :<br />

2 3 5 7 13 17 19 31<br />

61 89 107 127 521 607 1279 2203<br />

2281 3217 4253 4423 9689 9941 11213 19937<br />

21701 23209 44497 86243 110503 132049 216091 756839<br />

859433 1257787 1398269 2976221 3021377 6972593 13466917 20996011<br />

24036583 25964951 30402457 32582657 37156667 42643801 43112609<br />

The first prime ever found by a computer was<br />

known prime known today is<br />

was discovered in 2008!<br />

3<br />

5<br />

M in 1952, and the largest<br />

521<br />

521<br />

2 1<br />

43,112,609<br />

M<br />

43,112,609<br />

2 1 which has 12,978,189 digits and<br />

p<br />

Let us consider a prime divisor q of M 2 1 where p is a prime. Then we know that<br />

p<br />

p<br />

mod q , 2 1. Since the order of 2 mod q has to be a divisor of p , then we know that<br />

the order is p since it is not 1. But then by <strong>Fermat</strong>’s <strong>Little</strong> <strong>Theorem</strong>, p| q 1. Thus<br />

q kp 1 and since q is odd, it must be that k is even, and so we have proven that<br />

If q is a prime factor of M , then q 2kp 1.<br />

In the list of Mersenne Primes given above, the first five omissions were: 11, 23, 29, 37,<br />

and 41. The table below illustrates why:<br />

p M p<br />

Primes of the form 2kp 1 Factorization of M p<br />

11 2047 23, 67, 89, … 23 89<br />

23 8388607 47, 139, 277, 461,… 47 178481<br />

29 536870911 233, 349, 523, 639,… 233 1103 2089<br />

37 13743895347 149, 223, 593, 1259,… 223 616318177<br />

41 2199023255551 83, 329, 739, 821,… 13367 164511353<br />

Later on we will see a connection between Mersenne primes and the Classical Greece<br />

idea of a perfect number.<br />

p<br />

7<br />

n


89<br />

Example 10. Repunits Revisited. Consider the case a 10 and b 1, then we can<br />

recognize A<br />

n n, the repunit with n digits—all ones.<br />

Thus, when we apply the theorem to t<strong>his</strong> case, we get<br />

the g.c.d. of two repunits is the repunit of the g.c.d..<br />

For example,<br />

100 130 10 .<br />

And of course if<br />

n<br />

is to be a prime, then n will have to be also,<br />

2<br />

One can extend the idea of the An<br />

s as follows. Let p( x)<br />

x mx n be a polynomial<br />

with integer coefficients, so mn , , and assume m n 1. Let and be its roots<br />

(which may be complex numbers). Note that m and n . We define a<br />

sequence as follows:<br />

S ( m, n)<br />

S .<br />

k<br />

The case we discussed above corresponded to the case m a b and n ab since our<br />

roots were a and b . For example, the Mersenne case corresponds to the polynomial<br />

2<br />

p( x) x 3x 2.<br />

It is not difficult to show that S<br />

1<br />

1 and S2<br />

m, and from then on<br />

Sk 1<br />

mSk nS<br />

k 1,<br />

and thus we can conclude they are all integers.<br />

Although the proofs are a bit more technical and not necessarily appropriate for t<strong>his</strong><br />

course, we need to remark that it is still true that<br />

if d | k, then Sd<br />

| S<br />

k<br />

,<br />

and that<br />

Sk Sl S<br />

k l<br />

.<br />

One of the most famous cases of t<strong>his</strong> generalization is<br />

Example 11. The Fibonacci Numbers. Take the polynomial<br />

1 5<br />

m n 1. Then<br />

and<br />

2<br />

Sk 1<br />

Sk S<br />

k 1, we have that Sk F<br />

k, the<br />

k<br />

k<br />

k<br />

2<br />

p x x x 1, so<br />

1 5<br />

. Since S<br />

1<br />

1, S2 m 1 and<br />

2<br />

th<br />

k Fibonacci number. So we have that<br />

5<br />

and we also get that Fk Fl F<br />

k l<br />

as mentioned in a previous section.<br />

F<br />

k<br />

k<br />

k


90<br />

Similarly to the<br />

A ' s, we could consider<br />

n<br />

n n<br />

Bn<br />

a b ,<br />

where we still assume a and b are relatively prime. As before some examples are given<br />

below:<br />

a b B<br />

1<br />

B<br />

2<br />

B<br />

3<br />

B<br />

4<br />

B<br />

5<br />

B<br />

6<br />

B<br />

7<br />

B<br />

8<br />

B<br />

9<br />

B<br />

10<br />

2 1 3 5 9 17 33 65 129 257 513 1025<br />

3 2 5 13 35 97 275 793 2315 6817 20195 60073<br />

4 3 7 25 91 337 1267 4825 18571 72097 281827 1107625<br />

5 2 7 29 133 641 3157 15689 78253 390881 1953637 9766649<br />

5 3 8 34 152 706 3368 16354 80312 397186 1972808 9824674<br />

6 1 7 37 217 1297 7777 46657 279937 1679617 10077697 60466177<br />

6 5 11 61 341 1921 10901 62281 358061 2070241 12030821 70231801<br />

7 2 9 53 351 2417 16839 117713 823671 5765057 40354119 282476273<br />

7 5 12 74 468 3026 19932 133274 901668 6155426 42306732 292240874<br />

8 3 11 73 539 4177 33011 262873 2099339 16783777 134237411 1073800873<br />

8 5 13 89 637 4721 35893 277769 2175277 17167841 136170853 1083507449<br />

9 2 11 85 737 6577 59081 531505 4783097 43046977 387421001 3486785425<br />

9 5 14 106 854 7186 62174 547066 4861094 43437346 389373614 3496550026<br />

9 7 16 130 1072 8962 75856 649090 5606512 48811522 427774096 3769259650<br />

10 1 11 101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001<br />

10 3 13 109 1027 10081 100243 1000729 10002187 100006561 1000019683 10000059049<br />

10 7 17 149 1343 12401 116807 1117649 10823543 105764801 1040353607 10282475249<br />

Table of<br />

The claims about the<br />

nevertheless. It is still true that<br />

Bn<br />

s for various a s & b s<br />

Bn<br />

s are not as elegant as those for the<br />

B a 1 B b<br />

in a similar fashion: if mod prime p , B<br />

n<br />

0 and a 0, then so is b 0<br />

Here the relevant theorem is a little weaker:<br />

<strong>Theorem</strong>. GCDs and<br />

and<br />

Bn<br />

m<br />

are both odd, then Bn Bm B<br />

n m<br />

.<br />

n m<br />

n<br />

n<br />

' s. Let n and m be positive integers. If<br />

An<br />

s, but they are interesting<br />

, and vice versa.<br />

n<br />

Proof. The proof is similar to the one before. Let d n m and k . We consider<br />

d<br />

d d<br />

d d n d k d k n<br />

computations mod a b . In that mod, a b , so a ( a ) ( b ) b since k<br />

is odd. Similarly,<br />

a<br />

m<br />

m<br />

b , and so we get that<br />

d d<br />

a b is a common divisor of<br />

m<br />

n<br />

n<br />

m<br />

B and<br />

B<br />

n<br />

. As before, we can assume there exists positive integers r and s such that<br />

d rm sn. But then 1<br />

r m<br />

s n<br />

d d<br />

. So mod 2, we get that 1 r s, or in other words, r


91<br />

and s have different parities. Let q be a common divisor of<br />

m<br />

a<br />

Then mod q , we have that 1<br />

b<br />

a<br />

b<br />

rm<br />

1<br />

B<br />

m<br />

and<br />

B<br />

n<br />

(so q b 1).<br />

n<br />

a<br />

and 1. But then (still mod q )<br />

b<br />

ns<br />

a<br />

depending on whether r is even or odd, but also 1<br />

b<br />

have different parity. Now since<br />

a<br />

b<br />

d<br />

1<br />

mod q , and so q divides<br />

since r and s<br />

d mr ns<br />

a a a<br />

, we get that in either case<br />

b b b<br />

d d<br />

a b . <br />

Example 12. Let a 7 and b 2 . Then B<br />

6<br />

117713 and B<br />

9<br />

40354119<br />

. One can<br />

verify that B6 B<br />

9<br />

1, and the conclusion of the theorem does not hold. But neither does<br />

6<br />

the hypothesis since 6 9 3 and<br />

3<br />

B<br />

10<br />

282476273 and B6 B10 53 B<br />

2<br />

.<br />

2 , which is even. On the other hand,<br />

As a corollary, we get the following statement (which also explains what occurred in the<br />

previous example):<br />

Corollary. Let d be a divisor of n . Then<br />

only if d<br />

n is odd. Moreover, if d<br />

n is even, then<br />

B<br />

d<br />

is a divisor of<br />

B<br />

d<br />

divides<br />

B<br />

n<br />

if and<br />

n d<br />

Proof. If is odd, since n d d and is odd, we get n<br />

Bn Bd B<br />

d<br />

. If is even,<br />

d d d<br />

then mod<br />

d d<br />

a b ,<br />

n n<br />

An<br />

a b , not<br />

a<br />

d<br />

d<br />

b , so<br />

n<br />

n d d n<br />

a b b , so<br />

A<br />

n<br />

.<br />

d d<br />

Bd<br />

a b is a factor of<br />

n n<br />

Bn<br />

a b . <br />

Example 13. Let a 7 and b 2 . Then B3<br />

351 and A6 23517 B<br />

3<br />

67 .<br />

In particular,<br />

n n<br />

if Bn<br />

a b is prime, then n cannot have any odd divisors<br />

—in other words,<br />

n has to be a power of 2 ,<br />

and of course, one of a and b has to be even.<br />

Here are a few values (the primes are bolded):


92<br />

a<br />

b<br />

B<br />

1<br />

B<br />

2<br />

B<br />

4<br />

B<br />

8<br />

B16<br />

2 1 3 5 17 257 65537<br />

3 2 5 13 97 6817 43112257<br />

4 1 5 17 257 65537 4294967297<br />

4 3 7 25 337 72097 4338014017<br />

5 2 7 29 641 390881 152587956161<br />

6 1 7 37 1297 1679617 2821109907457<br />

10 1 11 101 10001 100000001 10000000000000001<br />

Finally, we end the section with <strong>Fermat</strong>’s most famous mistake. The most interesting of<br />

all the B s is the case a 2 . and b 1 In that case they are named after <strong>Fermat</strong> himself.<br />

n<br />

n<br />

Example 14. The <strong>Fermat</strong> Primes. So we are concerned now with B 2 1. We know<br />

that if<br />

B is to be a prime, then n has to be a power of 2. So we will refer to these<br />

n<br />

k<br />

2<br />

2 1<br />

numbers: Fk as the <strong>Fermat</strong> numbers. We see that F<br />

0<br />

3, F<br />

1<br />

5, F<br />

2<br />

17 ,<br />

F<br />

3<br />

257 , and F<br />

4<br />

65537 are all primes indeed. <strong>Fermat</strong>’s error in prediction came when<br />

he conjectured that all of them would be primes.<br />

Certainly F k<br />

is odd, and hence relatively prime to 2. Let p be a divisor of F k<br />

. Then the<br />

order of 2 mod p has to divide p 1 as we saw before. But mod p , 0, so<br />

2<br />

so 2 k 1<br />

1. So the order of 2 mod p has to be a divisor of<br />

n<br />

F k<br />

k<br />

2<br />

2 1<br />

1<br />

2 k , but any proper divisor<br />

of t<strong>his</strong> number is a divisor of 2 k and t<strong>his</strong> exponent does not give 1, so the order is<br />

k 1<br />

1<br />

Thus, 2 | p 1, or p 1 mod 2 k 1<br />

, or equivalently, p 1 r 2 k for some r .<br />

,<br />

1<br />

2 k .<br />

3<br />

2<br />

We can easily prove now that F 3<br />

2 1 257 is prime, since if it were to have a prime<br />

divisor p , then p 1 16r, and so the smallest possible prime is 17, but it is already<br />

bigger than<br />

257 . Short sieve!<br />

4<br />

2<br />

Let us consider F 4<br />

2 1 65537 . Any prime divisor of it would have to satisfy<br />

p 1 mod 32 , which limits p to be in the list 33, 65, 97, 129, 161, 193 and 225 since we<br />

are stopping before 65537 256. Of these, if we look at the list of primes, we only<br />

have two: 97and 193. Since these are not factors of 65,537 we can conclude the latter is<br />

prime. Short sieve again!<br />

Unfortunately for <strong>Fermat</strong> who believed all the F k<br />

’s were primes, Euler (who was the<br />

person responsible for first proving <strong>Fermat</strong>’s own <strong>Little</strong> <strong>Theorem</strong>) proved that<br />

32<br />

F5<br />

2 1=4294967297= (641)(6700417)<br />

is not a prime. As usual, any prime divisor p of it would have to satisfy p 1 mod 64 .<br />

The first five primes that satisfy p 1 mod 64 are 193, 257, 449, 577 and 641. Thus, the


93<br />

factor 641 is not that difficult to find. Note that the other factor: 6700417 is of the same<br />

form: 6700417 64 104694 1, which is a little further on in the list to be tested.<br />

In fact, we know of no other <strong>Fermat</strong> primes besides those 5 on the list above: 3, 5, 17,<br />

257, and 65537. As of 2008, it is known that F k<br />

is composite for 5 k 32 . Note<br />

32<br />

2<br />

F 32<br />

2 1<br />

4294967296<br />

2 1.<br />

More than 100 years after <strong>Fermat</strong>, and shortly after Euler’s death, Gauss made an<br />

unexpected and remarkable connection between <strong>Fermat</strong> primes and constructability of a<br />

regular polygon by straightedge and compass alone. Namely, Gauss proved that<br />

a polygon can be built with straight edge and compass alone if and only the<br />

number of sides is a power of two times a product of distinct <strong>Fermat</strong> primes!<br />

So we can construct the 17-gon, 257-gon and the 65537-gon because they are <strong>Fermat</strong><br />

primes, and the Pentadecagon (15) because it is a product of distinct <strong>Fermat</strong> primes. In<br />

particular, we cannot construct using straightedge and compass alone a regular heptagon<br />

since 7 is not a <strong>Fermat</strong> prime. Isn't t<strong>his</strong> sort of amazing?<br />

Note that since the order of 2 mod any prime divisor of F k<br />

is<br />

1<br />

2 k , we cannot have any<br />

prime dividing F k<br />

and F m<br />

, and so they are always relatively primes. T<strong>his</strong> provides<br />

another reason why there are infinitely many primes.<br />

In the next section we will pursue the generalization of <strong>Fermat</strong>’s <strong>Little</strong> <strong>Theorem</strong> to other<br />

mods besides primes—a generalization Euler accomplished after much deliberation.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!