Fermat and Mersenne Primes

Mแป™t phแบงn cแปงa tร i liแป‡u Number theory rรณbert freud, edit gyarmati (Trang 130 - 137)

In this section we investigate the primes of the form2๐‘˜+ 1and2๐‘˜โˆ’ 1; they are called FermatandMersenneprimes, respectively. As mentioned in the previous section, it is unknown whether or not there exist infinitely many Fermat or Mersenne primes.

In Exercise 1.4.4 we have seen that if2๐‘˜+1is a prime, then๐‘˜is necessarily a power of two, whereas if2๐‘˜โˆ’ 1is a prime, then๐‘˜itself must be a prime. Thus it is enough to investigate the Fermat numbers๐น๐‘›= 22๐‘›+ 1and the Mersenne numbers๐‘€๐‘= 2๐‘โˆ’ 1 (where๐‘is a prime).

We consider Fermat numbers first. Fermat believed that๐น๐‘›was always a prime (this isnotthe famous Fermatโ€™s Last Theorem to be discussed in Chapter 7). For0 โ‰ค ๐‘› โ‰ค 4these are primes (3,5,17,257, and65537), but Euler showed that๐น5= 232+ 1is composite, since it is divisible by641.

As of February 2019 we know that๐น๐‘›is composite for5 โ‰ค ๐‘› โ‰ค 32and also for some larger values of๐‘›. The record is๐น3329780 (with more than101000000decimal digits!) having a factor193 โ‹… 23329782+ 1. No other Fermat primes have been found other than the๐น๐‘› with๐‘› โ‰ค 4. We have no information about๐น33. No factors of๐น20or ๐น24 are known (though they are known to be composite). The factorization of๐น5,๐น6, and๐น7

can be found in the table of Fermat numbers at the end of this book (the complete factorization of๐น๐‘›is known only for๐‘› โ‰ค 11).

The Fermat primes play a central role in the Euclidean constructibility of regular polygons: Gaussโ€™s theorem states that a regular๐‘-gon is constructible if and only if the standard form of๐‘, ๐‘ โ‰ฅ 3is๐‘ = 2๐›ผ๐‘1. . . ๐‘๐‘Ÿwhere๐›ผ โ‰ฅ 0,๐‘Ÿ โ‰ฅ 0, and the numbers๐‘๐‘–

are distinct Fermat primes. The first few values are๐‘ = 3,4,5,6,8,10,12,15,16,17, 20, . . . .

5.2. Fermat and Mersenne Primes 119

The following two theorems give practical tools for investigating the Fermat num- bers. Theorem 5.2.1 is an effective help in finding their prime divisors and Theo- rem 5.2.2 yields a (relatively) fast algorithm to test whether a given Fermat number is prime or composite.

Theorem 5.2.1. Any (positive) divisor of๐น๐‘›is of the form๐‘˜2๐‘›+1+ 1, and for๐‘› โ‰ฅ 2it is

of the form๐‘Ÿ2๐‘›+2+ 1. โ™ฃ

Presumably Euler used this theorem for proving that๐น5 is composite: the prime divisors of๐น5can only be primes of form128๐‘˜ + 1. The first two of these are257and 641, and the latter one divides๐น5.

Proof. First we verify the statement if the divisor is a prime๐‘. Then๐‘ โˆฃ ๐น๐‘›means

(5.2.1) 22๐‘›โ‰ก โˆ’1 (mod ๐‘) .

Squaring both sides, we obtain

(5.2.2) 22๐‘›+1โ‰ก 1 (mod ๐‘) .

By Theorem 3.2.2(i),

2๐‘—โ‰ก 1 (mod ๐‘) โŸบ ๐‘œ๐‘(2) โˆฃ ๐‘—.

Hence (5.2.2) implies

๐‘œ๐‘(2) โˆฃ 2๐‘›+1, and by (5.2.1), we have

๐‘œ๐‘(2) โˆค 2๐‘›,

since clearly๐‘ > 2, and thusโˆ’1 โ‰ข 1 (mod ๐‘). It follows that ๐‘œ๐‘(2) = 2๐‘›+1.

Using๐‘œ๐‘(2) โˆฃ ๐‘ โˆ’ 1, we obtain2๐‘›+1โˆฃ ๐‘ โˆ’ 1, so๐‘ = ๐‘˜2๐‘›+1+ 1for a suitable integer๐‘˜.

If๐‘› โ‰ฅ 2, then this implies๐‘ = 8๐‘  + 1, so (2

๐‘) = 1, hence 2๐‘โˆ’12 โ‰ก 1 (mod ๐‘) . Therefore

๐‘œ๐‘(2) = 2๐‘›+1|

| ๐‘ โˆ’ 1 2 , so๐‘ = ๐‘Ÿ2๐‘›+2+ 1for a suitable integer๐‘Ÿ.

These results can be written also as๐‘ โ‰ก 1 (mod 2๐‘›+1), and for๐‘› โ‰ฅ 2, as๐‘ โ‰ก 1 (mod 2๐‘›+2).

Consider an arbitrary divisor๐‘‘ โˆฃ ๐น๐‘›. Write๐‘‘ as the product of (not necessarily distinct) primes (if๐‘‘ > 1):๐‘‘ = ๐‘1. . . ๐‘๐‘ . We have just proven that๐‘๐‘– โ‰ก 1 (mod 2๐‘›+1) for every๐‘–. Multiplying these congruences, we see that also๐‘‘ โ‰ก 1 (mod 2๐‘›+1)holds.

We can use the same argument also for the modulus2๐‘›+2. โ–ก Theorem 5.2.2(Pepinโ€™s test). Let๐‘› โ‰ฅ 1. Then๐น๐‘›is prime if and only if

โ™ฃ (5.2.3) 3(๐น๐‘›โˆ’1)/2โ‰ก โˆ’1 (mod ๐น๐‘›) .

Proof. Assume first that๐น๐‘›is a prime. Then (5.2.3) means that3is a quadratic non- residue modulo๐น๐‘›, i.e.

(3 ๐น๐‘›

) = โˆ’1.

To verify this, we use that๐‘› โ‰ฅ 1yields22๐‘› = 4๐‘ก, hence

๐น๐‘›โ‰ก 1 (mod 4) , and ๐น๐‘›= 4๐‘ก+ 1 โ‰ก โˆ’1 (mod 3) . Applying quadratic reciprocity, we obtain

(3

๐น๐‘›) = (๐น๐‘›

3 ) = (โˆ’1 3 ) = โˆ’1.

To prove the converse, assume that (5.2.3) holds. Squaring both sides, we get

(5.2.4) 3๐น๐‘›โˆ’1โ‰ก 1 (mod ๐น๐‘›) .

Congruences (5.2.4) and (5.2.3) imply

๐‘œ๐น๐‘›(3) โˆฃ ๐น๐‘›โˆ’ 1 and ๐‘œ๐น๐‘›(3) โˆค ๐น๐‘›โˆ’ 1 2 . Since๐น๐‘›โˆ’ 1is a power of two, we infer

๐‘œ๐น๐‘›(3) = ๐น๐‘›โˆ’ 1.

Therefore๐น๐‘›โˆ’ 1 โˆฃ ๐œ‘(๐น๐‘›)follows. Clearly๐œ‘(๐น๐‘›) โ‰ค ๐น๐‘›โˆ’ 1, therefore๐น๐‘›โˆ’ 1 = ๐œ‘(๐น๐‘›), or

equivalently,๐น๐‘›is a prime. โ–ก

Using Theorem 5.2.2, we can show the compositeness of๐น5= 232+1by computing the residue of3231 modulo๐น5 by31squarings and reducing modulo๐น5in every step.

It turns out that this residue is notโˆ’1. Moreover, even Fermatโ€™s Little Theorem is sufficient for our purposes:32such steps of squaring and reduction reveal

3๐น5โˆ’1= 3232โ‰ข 1 (mod ๐น5) ,

hence๐น5 cannot be a prime. So Fermat could have disproved his conjecture about Fermat primes with his own theorem (the computations would have been no obstacle since even more lengthy calculations were regularly done in those times).

Theorem 5.2.2 is an efficient tool in general for determining whether a Fermat number is prime or composite: we can check the validity of (5.2.3) quickly by repeated squarings (and reducing modulo๐น๐‘›); we need altogether2๐‘›โˆ’1 โ‰ˆ log2๐น๐‘›such steps.

Unfortunately, the practical application is limited by the fact that the Fermat numbers grow with enormous speed,๐น๐‘›โ‰ˆ ๐น๐‘›โˆ’12 , therefore computers are unable to handle even relatively small values of๐‘›.

Now we turn to study the Mersenne numbers๐‘€๐‘ = 2๐‘โˆ’ 1(where๐‘is a prime). It is easy to see that not all of them are primes; the smallest composite number is obtained for๐‘ = 11:

211โˆ’ 1 = 2047 = 23 โ‹… 89.

The significance of Mersenne primes lies, partly, in their connection with the even perfect numbers (see Theorem 6.3.2). Mersenne was a superb scientific manager in the seventeenth century, corresponding intensively with Fermat, Descartes, and other

5.2. Fermat and Mersenne Primes 121

leading scientists, and encouraged the search for such primes in the hope of finding new perfect numbers.

Mersenne was aware of the difficulty of determining whether a large integer is prime or composite. He wrote in his book in 1644: โ€œTo tell if a given number of15or 20digits is prime or not, all time would not suffice for the test, whatever use is made of what is already known.โ€ A few pages later, however, we can read his claim that:2๐‘โˆ’ 1 is a prime for๐‘ = 2,3,5,7,13,17,19,31,67,127,257, but for no other values of๐‘ below 257.

For more than two centuries, nobody knew whether Mersenneโ€™s list was correct or not. The first error was discovered in 1876(!) by another Frenchman, ร‰douard Lucas, who proved that267โˆ’ 1is composite. It is interesting that Lucas proved the compos- iteness of267โˆ’ 1without exhibiting any factors of it (based on Theorem 5.2.4 bearing also his name). The factorization

193707721 โ‹… 761838257287

was found only in 1903(!) by the American mathematician F. N. Cole who spent three years of Sunday afternoons wrestling with the problem (remember, he had to work by hand without computers, since these were invented half a century later).

Later four other errors were discovered in Mersenneโ€™s list: the missing261 โˆ’ 1, 289โˆ’ 1, and2107โˆ’ 1are primes and2257โˆ’ 1is composite.

The presently (as of February 2019) known51Mersenne primes are2๐‘โˆ’ 1where ๐‘ = 2,3,5,7,13,17,19,31,61,89,107,127,521,607,1279,2203,2281,3217,4253, 4423,9689,9941,11213,19937,21701,23209,44497,86243,110503,132049,216091, 756839,859433,1257787,1398269,2976221,3021377,6972593,13466917,20996011, 24036583,25964951,30402457,32582657,37156667,42643801,43112609,57885161, 74207281,77232917, and82589933. The last number,282589933โˆ’ 1is the largest known primeโ€”it has24862048decimal digits! It is a famous unsolved problem whether there are infinitely many Mersenne primes.

In the table of Mersenne numbers at the end of this book you can find the prime factorization of all composite Mersenne numbers for the (prime) exponents between 10and100.

Now we prove the analogues of Theorems 5.2.1 and 5.2.2 for Mersenne numbers.

Theorem 5.2.3. Let๐‘ > 2be a prime. Then any (positive) divisor of๐‘€๐‘ = 2๐‘โˆ’ 1is of

the forms2๐‘˜๐‘ + 1and8๐‘Ÿ ยฑ 1. โ™ฃ

Example. Consider๐‘ = 47. Then for any prime divisor๐‘žof๐‘€47 = 247โˆ’ 1, we have ๐‘ž = 94๐‘˜ + 1 = 8๐‘Ÿ ยฑ 1. Solving the system of simultaneous congruences

๐‘ฅ โ‰ก 1 (mod 94) , ๐‘ฅ โ‰ก ยฑ1 (mod 8) we obtain

๐‘ฅ โ‰ก 1or95 (mod 376) . The primes satisfying these conditions are

๐‘ž = 1129, 1223, 2351, . . . We find that2351 โˆฃ ๐‘€47, hence๐‘€47is composite.

It is conceivable that also Mersenne found this divisor of๐‘€47, and therefore he did not include๐‘ = 47into his list (and the missing of this value is not just a lucky coincidence).

Proof. Similar to the argument seen at the Fermat numbers, it is sufficient to prove the statement for prime divisors.

Assume that a prime๐‘žsatisfies

๐‘ž โˆฃ 2๐‘โˆ’ 1, i.e. 2๐‘โ‰ก 1 (mod ๐‘ž) . Then๐‘œ๐‘ž(2) โˆฃ ๐‘, and๐‘œ๐‘ž(2) โ‰  1, hence๐‘œ๐‘ž(2) = ๐‘.

We infer๐‘ โˆฃ ๐‘ž โˆ’ 1, thus๐‘ž = ๐‘ก๐‘ + 1. Since๐‘žand๐‘are odd, therefore๐‘กis even, so ๐‘ž = 2๐‘˜๐‘ + 1.

To verify๐‘ž = 8๐‘Ÿ ยฑ 1, we have to show that2is a quadratic residue mod๐‘ž. This follows from the congruence2๐‘โ‰ก 1 (mod ๐‘ž)by the properties of the Legendre symbol using that๐‘is odd:

(2 ๐‘ž) = (2

๐‘ž)

๐‘

= (2๐‘ ๐‘ž) = (1

๐‘ž) = 1. โ–ก

Theorem 5.2.4(Lucasโ€“Lehmer-test). Let๐‘ > 2be a prime,๐‘Ž1= 4, and๐‘Ž๐‘–+1= ๐‘Ž2๐‘– โˆ’ 2 for๐‘– โ‰ฅ 1. Then๐‘€๐‘is a prime if and only if

โ™ฃ

(5.2.5) ๐‘€๐‘โˆฃ ๐‘Ž๐‘โˆ’1.

Example. Put๐‘ = 5. Then

๐‘Ž1 = 4, ๐‘Ž2 = 14, ๐‘Ž3= 194 โ‰ก 8 (mod 31) , and ๐‘Ž4โ‰ก 62 โ‰ก 0 (mod 31) , hence๐‘€5= 31is a prime.

When checking (5.2.5), we compute the modulo๐‘€๐‘remainders of the๐‘Ž๐‘–, which requires๐‘ โˆ’ 2 โ‰ˆ log2๐‘€๐‘steps of squaring (plus subtracting and reducing).

Proof. The numbers๐‘Ž+๐‘โˆš3(where๐‘Ž, ๐‘are integers) form a (commutative) ring (with identity element and without zero divisors) for the usual operations; we denote this ring by๐ป. In our proof we shall rely on the elementary properties of divisibility, con- gruences, and order in๐ป(which hold exactly the same way as for the integers). Unique prime factorization is valid in๐ป(see Theorem 10.3.6 and Exercise 10.3.1), but we shall not need this result in our argument.

I. We can easily verify by induction that

๐‘Ž๐‘˜= (2 + โˆš3)2๐‘˜โˆ’1+ (2 โˆ’ โˆš3)2๐‘˜โˆ’1 holds for every๐‘˜. Hence (5.2.5) is equivalent to the divisibility (5.2.6) ๐‘€๐‘โˆฃ (2 + โˆš3)2๐‘โˆ’2 + (2 โˆ’ โˆš3)2๐‘โˆ’2. Factoring the right-hand side in (5.2.6), we obtain

(5.2.7) ๐‘€๐‘โˆฃ (2 โˆ’ โˆš3)2๐‘โˆ’2((2 + โˆš3)2๐‘โˆ’1+ 1).

We note that the divisibility in (5.2.7) holds among the integers if and only if it is valid in๐ป(see Exercise 5.2.10), and(2 โˆ’ โˆš3)(2 + โˆš3) = 1implies that2 ยฑ โˆš3raised to

5.2. Fermat and Mersenne Primes 123

integer powers are units in๐ป. Therefore (5.2.7) and thus (5.2.5) are equivalent to the congruence

(5.2.8) (2 + โˆš3)2๐‘โˆ’1 โ‰ก โˆ’1 (mod ๐‘€๐‘) .

We conclude that Theorem 5.2.4 can be reformulated as follows:๐‘€๐‘is a prime if and only if (5.2.8) holds.

II. We shall need the following lemma: For any prime๐‘ž > 3, we have (5.2.9) (๐‘Ž + ๐‘โˆš3)๐‘žโ‰ก ๐‘Ž + (3

๐‘ž) ๐‘โˆš3 (mod ๐‘ž) . Proof of the lemma: Consider the binomial expansion (5.2.10) (๐‘Ž + ๐‘โˆš3)๐‘ž= ๐‘Ž๐‘ž+ (๐‘ž

1)๐‘Ž๐‘žโˆ’1๐‘โˆš3 + (๐‘ž

2)๐‘Ž๐‘žโˆ’23๐‘2+ โ‹ฏ + ๐‘๐‘ž3(๐‘žโˆ’1)/2โˆš3.

By Fermatโ€™s Little Theorem,

๐‘Ž๐‘žโ‰ก ๐‘Ž (mod ๐‘ž) and ๐‘๐‘žโ‰ก ๐‘ (mod ๐‘ž) , further, each of

(๐‘ž 1), (๐‘ž

2), . . . , ( ๐‘ž ๐‘ž โˆ’ 1) is divisible by๐‘ž, and

3(๐‘žโˆ’1)/2โ‰ก (3

๐‘ž) (mod ๐‘ž) . Substituting these into (5.2.10), we obtain (5.2.9) as stated.

III. Now we are in the position to show that (5.2.8) implies the primality of๐‘€๐‘. Squaring (5.2.8), we have

(5.2.11) (2 + โˆš3)2๐‘ โ‰ก 1 (mod ๐‘€๐‘) .

Let๐‘žbe a prime divisor of๐‘€๐‘(clearly๐‘ž > 3). Then (5.2.11) and (5.2.8) hold also for the modulus๐‘žinstead of๐‘€๐‘. This yields (similar to the argument used in the proofs of Theorems 5.2.1 and 5.2.2) that๐‘œ๐‘ž(2 + โˆš3) = 2๐‘.

If(3๐‘ž) = 1, then by (5.2.9) we obtain

(2 + โˆš3)๐‘žโˆ’1= (2 โˆ’ โˆš3)(2 + โˆš3)๐‘žโ‰ก (2 โˆ’ โˆš3)(2 + โˆš3) = 1 (mod ๐‘ž) , hence

๐‘œ๐‘ž(2 + โˆš3) = 2๐‘โ‰ค ๐‘ž โˆ’ 1.

But this is impossible since๐‘ž โ‰ค ๐‘€๐‘= 2๐‘โˆ’ 1.

If(3๐‘ž) = โˆ’1, then similarly

(2 + โˆš3)๐‘ž+1โ‰ก (2 โˆ’ โˆš3)(2 + โˆš3) = 1 (mod ๐‘ž) , thus

๐‘œ๐‘ž(2 + โˆš3) = 2๐‘โ‰ค ๐‘ž + 1.

Comparing this with๐‘ž โ‰ค ๐‘€๐‘= 2๐‘โˆ’ 1, we have๐‘ž = ๐‘€๐‘, i.e.๐‘€๐‘is a prime.

IV. Finally, we prove that if๐‘€๐‘is a prime, then (5.2.8) must hold.

We shall use that๐‘€๐‘โ‰ก โˆ’1 (mod 8)implies

(5.2.12) ( 2

๐‘€๐‘

) = 1,

further, using๐‘€๐‘โ‰ก 1 (mod 3),๐‘€๐‘โ‰ก โˆ’1 (mod 4), and the law of reciprocity we get

(5.2.13) ( 3

๐‘€๐‘) = โˆ’ (๐‘€๐‘

3 ) = โˆ’ (1 3) = โˆ’1.

Starting from the equality

2(2 + โˆš3) = (1 + โˆš3)2, we raise both sides to the power(๐‘€๐‘+ 1)/2 = 2๐‘โˆ’1:

(5.2.14) 2(๐‘€๐‘+1)/2โ‹… (2 + โˆš3)2๐‘โˆ’1 = (1 + โˆš3)๐‘€๐‘+1.

For the first factor on the left-hand side of (5.2.14), using (5.2.12), we obtain (5.2.15) 2(๐‘€๐‘+1)/2= 2 โ‹… 2(๐‘€๐‘โˆ’1)/2โ‰ก 2 ( 2

๐‘€๐‘) = 2 (mod ๐‘€๐‘) .

The right-hand side of (5.2.14) can be transformed as follows, applying (5.2.9) with ๐‘Ž + ๐‘โˆš3 = 1 + โˆš3and๐‘ž = ๐‘€๐‘, and using (5.2.13):

(5.2.16)

(1 + โˆš3)๐‘€๐‘+1= (1 + โˆš3)(1 + โˆš3)๐‘€๐‘

โ‰ก (1 + โˆš3)(1 + ( 3 ๐‘€๐‘) โˆš3)

= (1 + โˆš3)(1 โˆ’ โˆš3) = โˆ’2 (mod ๐‘€๐‘) . Substituting (5.2.15) and (5.2.16) into (5.2.14), we infer

(5.2.17) 2(2 + โˆš3)2๐‘โˆ’1 โ‰ก โˆ’2 (mod ๐‘€๐‘) .

Multiplying (5.2.17) by2๐‘โˆ’1 and using2๐‘ โ‰ก 1 (mod ๐‘€๐‘), we obtain the desired con-

gruence (5.2.8). โ–ก

Exercises 5.2

1. (a) Verify๐น๐‘›+1= ๐น0๐น1. . . ๐น๐‘›+ 2.

(b) Demonstrate that the Fermat numbers are pairwise relatively prime (cf. Ex- ercise 1.3.14).

(c) Use part (b) to devise a new proof for the existence of infinitely many primes.

(d) Give a new proof for the statement of Exercise 5.1.9a.

2. Show that Theorem 5.2.2 remains valid for๐‘› โ‰ฅ 2if3 is replaced by5or10in formula (5.2.3).

3. Let๐‘› โ‰ฅ 2. Prove that๐พ๐‘›= 5 โ‹… 2๐‘›+ 1is a prime if and only if 3(๐พ๐‘›โˆ’1)/2โ‰ก โˆ’1 (mod ๐พ๐‘›) .

Mแป™t phแบงn cแปงa tร i liแป‡u Number theory rรณbert freud, edit gyarmati (Trang 130 - 137)

Tแบฃi bแบฃn ฤ‘แบงy ฤ‘แปง (PDF)

(563 trang)