<<

DEMONSTRATIO MATHEMATICA Vol. XXXIX No 4 2006

Alena Solcovâ, Michal Krizek

FERMAT AND MERSENNE IN PEPIN'S TEST1

Dedicated to Frantisek Katrnoska on his 75th birthday

Abstract. We examine Pepin's test for the primality of the Fermât numbers Fm = 2 2 + 1 for m = 0, 1, 2,.... We show that Dm = (Fm — l)/2 — 1 can be used as a base in Pepin's test for m > 1. Some other bases are proposed as well.

1. Introduction — historical notes In 1640 Pierre de Fermât incorrectly conjectured that all the numbers

(1.1) Fm = ¿T + 1 for m = 0, 1, 2,... are prime. The numbers Fm are called Fermât numbers after him. If Fm is prime, we say that it is a Fermât prime. The first five members of sequence (1.1) are really primes. However, in 1732 found that is composite. In this paper we examine admissible bases for the well-known Pepin's test, which is a sophisticated necessary and sufficient condition for the primality of Fm. It was discovered in 1877 by the French mathematician Jean François Théofile Pepin (1826-1904). He surely would have been surprised by how many mathematicians will have used his test for more than one hundred years until now. For instance, in 1905 J.C. Morehead and independently A.E. Western (see [5], [10]) found by computing the Pepin residue that the 39-digit Fj is composite without knowing any explicit nontrivial factor. Morehead and Western also manually calculated that Fg with 78 digits is composite (see [6]). Later F\o, F\s, F14, F20, and F22 were found to be composite by Pepin's test and by the use of electronic computers (the associated literature is given in [3]). Moreover, recently the twenty-fourth

Key words and phrases: Fermât primes, Mersenne numbers, primitive roots. 1991 Subject Classification: 11A07, 11A51. Supported by Institutional Research Plan nr. AV0Z 10190503 and Grant nr. 1P05ME749 of the Ministry of Education of the Czech Republic. 738 A. Solcovâ, M. Krizek

Fermât number F24, which has over 5 million decimal digits, was shown to be composite by Pepin's test (see [2]). This was the biggest computation ever done to obtain a simple "yes-or-no" answer. It required approximately 1017 computer operations. The computational complexity of Pepin's test is discussed in [4, p. 322]. Note that J. F. T. Pepin entered to the Jesuit Order in 1846. Therefore, some of his papers were published under the name: le P. Pepin, S. J., which means: Pater Pepin, Societatis Jesu. Although hundreds of factors of the Fermât numbers and many necessary and sufficient conditions for the primality of Fm are known (see, e.g., [3]), no one has yet been able to discover a general principle that would lead to a definitive answer to the question whether F4 is the largest Fermât prime.

2. Preliminaries

THEOREM 2.1 (Pepin's test). Let m > 1. Then {Fm l)/2 (2.1) Fm is prime Z ~ = -1 (mod Fm). REMARK 2.2. Pepin, in his original paper of 1877, used the base (seed) 5 for m > 1 rather than the base 3 (see [7]). The base 3 was later suggested in [8] by François Proth (1852-1879). Pepin also noted that the base 10 could be used instead of the base 5 in his test. This fact is generalized in the next lemma.

LEMMA 2.3. For any m > 1 and b > 0 we have 2 1 2 (2b)^'^ = ftC*»" )/ (mod Fm). Proof. If m > 0 and b > 0 then

2m+1 2m+1 2m+1 2m 2m b (2 - l) = b (2 - l) (2 + l) = 0 (mod Fm). Hence, m+1 2m+1 (2bf = b (mod Fm). m+1 Since 2 | (Fm - l)/2 for m > 1, the lemma follows. • Let m > 1. According to the Euler-Fermât , (2.1) and Remark 2.2, the Fermât primes 3 and 5 are primitive roots modulo a Fermât prime Fm. Moreover, by Lemma 2.3 the numbers of the sequences 3,6,12, 24,... and 5,10,20,... are admissible bases in Pepin's test and all of them are m+1 primitive roots modulo a Fermât prime Fm. Each sequence contains 2 incongruent terms modulo Fm. Vasilenko in [9] proves that

1)/2 1 (2.2) Fm-i' = (mod Fm) for m > 2. Fermât and Mersenne numbers in Pepin's test 739

His result and the Euler-Fermat theorem assert that Fm-\ is never a primi- tive root modulo a Fermat prime Fm for m > 2. The next lemma generalizes this fact.

LEMMA 2.4. Ifm>l then

(2.3) F^-V = -1 (mod Fm). Proof. From (1.1) we immediately get

Fl_, = (22"1-1 + l)2 = 22m + 1 + 2 • 22"1-1 = 2 • 22"1-1 (mod Fm) for m > 1. Squaring the foregoing congruence implies that

EE (2 . 22™-1)2 = 4 • 22" = 4(Fm - 1) = —22 (mod Fm). If m > 1 then 2m"1 > 2 and thus, (2.3) holds:

¿Ci = (-22)2"1-1 = 22™ = -1 (mod Fm). . We observe that the exponent 2m+1 on the left-hand side of congruence (2.3) is much smaller than the exponent (Fm — l)/2 in (2.2) for m > 2. Moreover, the right-hand side of (2.3) is equal to —1 as in Pepin's test (2.1).

3. Which Mersenne numbers can stand as a base in Pepin's test? The number Mp = 2P — 1, where p is prime, is called a Mersenne number. If 2P — 1 itself is prime, then it is called a . Due to Proth [8] we already know that M2 = 3 is a base in Pepin's test (2.1). Aigner in [1] shows that also M3 = 7 can stand as a base in (2.1) for any m > 1. Moreover, Vasilenko in [9] proves the following result. THEOREM 3.1 (Vasilenko). Let p be a prime of the form 4k + 3 and let Mp = 2P — 1 be the associated Mersenne number. Then the Fp is prime if and only if

M(FP-i)/2 = _i (mod Fp).

In Theorem 3.3 below we propose other Mersenne numbers that can stand as a base in Pepin's test.

REMARK 3.2. According to [3, p. 42], the base 3 in Pepin's test (2.1) can be replaced by any b such that for the we have

(——) = —1 for all m > 1. In other words, Fm is prime if and only if

(3.1) = (mod Fm). In the next theorem we show that for m > 1 the number

(3.2) Dm = 22"1-1 - 1 = - 1 740 A. SolcovA, M. Krizek can be a base in (3.1). We observe that some of Dm are Mersenne numbers 3 7 31 127 (primes), e.g., D2 = 2 - 1, D3 = 2 - 1, D5 = 2 - 1, D7 = 2 - 1, 8191 131071 524287 2147483647 D13 = 2 - 1, D17 = 2 - 1, D19 = 2 - 1, £»3! = 2 - 1.

THEOREM 3.3. For m > 1 i/ie Fermat number Fm is prime if and only if

(3.3) flCFm-D/2 = _! (mod Fm). Proof. By Remark 3.2 it is enough to show that

v rm ' First notice that (3.4) = -1 for m > 1. By (1.1) and the binomial theorem we observe that m k 2m k (3.5) Fm = (Fk - lf ~ + 1 = (-l) ~ + 1 = 2 (mod Fk) for all k = 0,1,..., m — 1. Hence, Fm = 2 (mod 3), which implies by (3.2) that

(3.6) Dm = 1 (mod 3). Now using the law of , basic properties of the Jacobi symbol (see [3, p. 25]), (3.4), (3.2), and (3.6), we get for m > 1 that (Bul) = (^D^^i^k) = (JL\ K = \FmJ ' \dJ \DJ \Dm) 3^Dm-l (Dm\ (Dm\ /1\

4. Final results

PROPOSITION 4.1. The only Fermat numbers that can stand as a base in Pepin's test for m > 1 are Fq = 3 and F\ = 5.

Proof. The case m = 2 follows from (2.1) and Lemma 2.4. So let Fm for m > 2 be given. We show that no Fermat number Fk with 1 < k < m can stand as a base b in Pepin's test (3.1). To see this we use Euler's criterion (see [3, p. 23])

F 1)/2 f"" = (£) (mod Fm). Therefore, by the law of quadratic reciprocit = y and= (3.5 L) (£) = (f) "

Theorem 3.3 is extended in the following proposition, which is proved in a rather different way. Fermât and Mersenne numbers in Pepin's test 741

PROPOSITION 4.2. The numbers Dm-2, Dm-l, Dm, Dm + 3, Dm + 4, and Dm + 5 are admissible bases in Pepin's test for m > 1. Proof. From the binomial theorem we have s s b = (Fm-b) (mod Fm) for any b € N and an even integer s > 0. Therefore, b can be a base in

Pepin's test if and only if the same holds for Fm — b. Since 3, 5, and 7 are such bases, the same has to be true for the numbers

2(Dm -2)=Fm-7, 2(Dm - 1) = Fm - 5, 2Dm = Fm - 3,

2 (Dm + 3) = Fm + 3, 2 (Dm + 4) = Fm + 5, 2 (Dm + 5) = Fm + 7. Now the rest of the proof follows from Lemma 2.3. •

Similarly to the above proof we get that (Dm — l)/2, (Dm + 3)/2, (Dm + 5)/2, and (Dm+5)/4 are admissible bases for Pepin's test for m > 1. Finally, we show how to generate all primitive roots modulo a prime Fm from a given primitive root.

PROPOSITION 4.3. Let b be an arbitrary primitive root modulo a Fermat pri- 2k 1 me Fm for m > 0. Then b ~ for k = 1,..., (Fm — l)/2 are all incongruent primitive roots modulo Fm. Proof. By inspection we find that the proposition holds for m < 1. So let m > 1. Then by (3.1) we get

(b2fc-i)(Fm-i)/2 = (6(Fm-i)/2)2fc-i = (_1)2fc-i = (mod Fm)y

2k l i.e., b ~ for k = 1,..., (Fm — 1)/2 are primitive roots modulo Fm. They are incongruent, since for 1 < k < t < (Fm — l)/2 we have b2k-i_b2e-i = b2e-i^b2(k-e)_^ = b2e-i^-e+1^bk-e_^ ^ Q (mod ^ where the last noncongruence follows from the definition of primitive roots. • Acknowledgement. The authors thank Lawrence Somer from Washing- ton, D.C., for valuable suggestions.

References

[1] A. Aigner, On prime numbers for which (almost) all Fermat numbers are quadratic nonresidues (German), Monatsh. Math. 101 (1986), 85-93. [2] R. E. Crandall, E. Mayer, J. Papadopoulos, The twenty-fourth Fermat number is composite, Math. Comp. 72 (2003), 1555-1572. [3] M. Krizek, F. Luca, L. Somer, 17lectures on Fermat numbers: From to , CMS Books in Mathematics, vol. 9, Springer-Verlag, New York, 2001. [4] A. K. Lenstra H. W. Lenstra, Jr., M. S. Manasse, J. M. Pollard, The factori- zation of the ninth Fermat number, Math. Comp. 61 (1993), 319-349. 742 A. Solcovâ, M. Krizek

[5] J. C. Morehead, Note on Fermat's numbers, Bull. Amer. Math. Soc. 11 (1905), 543-545. [6] J. C. Morehead, A. E. Western, Note on Fermat's numbers, Bull. Amer. Math. Soc. 16 (1910), 1-«. [7] P. Pépin, Sur la formule 22" + 1, C. R. Acad. Sei. 85 (1877), 329-331. [8] F. Proth, Mémoires présentés, C. R. Acad. Sei. Paris 87 (1878), 374. [9] O. N. Vasilenko, On some properties of Fermât numbers (Russian), Vestnik Mos- kov. Univ. Ser. I Mat. Mekh., no. 5 (1998), 56-58. [10] A. E. Western, Notes and corrections, Proc. London Math. Soc. 3(2) (1905), xxi- xxii.

Alena Solcovâ DEPARTMENT OF MATHEMATICS FACULTY OF CIVIL ENGINEERING THE CZECH TECHNICAL UNIVERSITY Thäkurova 7 CZ-166 29 PRAGUE 6, CZECH REPUBLIC e-mail: [email protected],

Michal Kfizek MATHEMATICAL INSTITUTE ACADEMY OF SCIENCES Zitnâ 25 CZ-115 67 PRAGUE 1, CZECH REPUBLIC e-mail: [email protected].

Received August 22, 2005; revised version October 18, 2005.