Fermat Numbers and Mersenne Numbers

By J. L. Selfridge and Alexander Hurwitz

    An IBM 7090 computer program, and results of testing Mersenne numbers M p  = 2 p  - 1 with p prime, p < 5000, have been described by Hurwitz [1]. This paper describes modifications made to his program, and further computational results. The main results are that the Fermat number F 14 is composite and that 2 p  - 1 is composite if 5000 < p < 6000.

    The computer program, originally written with the idea of testing 2 n  - 1 for n = M 13 , soon showed that the machine makes occasional errors. At least four machine errors occured during runs on this number before two results agreed. Due partly to the immediate availability of standby time, the program was then launched in the region 3300 < p < 5000.

    When this work was nearly complete, the routine was modified to incorporate a check modulo 2 35  - 1 after each squaring and another after each reduction modulo 2 p  - 1. These checks enabled the routine to recover and proceed automatically after a machine error. A message was printed that a squaring (or reduction) error had occured. In fact, this happened several times.

    Another modification enabled the program to compute 3 2 n   modulo  the  Fermat  number  F m  = 2 2 m  + 1. When n = 2 m  - 1 the residue was output, with a result congruent to -1 if and only if F m is prime.

    After testing the program using F 10 (see Robinson [5]), we proceeded to test F 14 . The computation was divided into 64 parts, and the results of the first 25 of these were checked against those of Paxson [3], who very kindly sent us copies of his intermediate residues. The rest of the computation was done twice, with complete agreement. We have also checked the final residue obtained by Paxson [3] in the testing of F 13 . The result that F 14 is composite was announced in [2].

TABLE 1
m n R mod 2 36 R mod 2 36  - 1 R mod 2 35  - 1
7 127 035100542404 514165207640 053153335617
8 255 531023263263 407614543114 344141643032
13 8191 607301005536 611677367012 031455470517
14 16383 622476273512 016631677043 161031465216
17 20 176536764625 415751561367 155276133751


TABLE 2
p R p R p R
5023 35472 5479 17227 5783 15446
5077 27063 5503 26142 5813 25753
5081 74607 5527 41614 5839 24031
5099 67662 5573 34740 5851 37460
5113 20010 5581 31446 5857 11252
5153 52273 5591 52563 5869 00764
5309 40357 5641 21342 5879 52670
5333 44244 5647 40775 5879 52670
5351 05171 5653 50244 5923 16616
5387 54357 5669 57031 5953 32461
5407 51133 5689 32731 5987 66731
5419 70701 5693 47014    
5443 51737 5701 33577    
5471 52563 5737 07151    
5477 33022 5749 47641    

    In addition, as a debugging aid for those who wish to test F 17 , we computed 3 2 20 modulo F 17 . The complete testing of F 17 would take 128 full weeks of machine time on an IBM 7090. It seems much more economical to search for small factors of F 17 than to perform this test.

    The final residues in the testing of F 7 , F 8 , F 13 , and F 14 , and the residue of 3 2 20 (mod F 17 ), have been put on punched cards, together with check sums. A summary of these residues is given in Table 1, and copies of the cards are available for checking purposes. The seven intermediate residues of 3 2 n (mod F 14 ) where n congruent to 0 (mod 2048), and the complete values of 3 1024 and 3 65536 are also on cards in the same format. In Table 1 the residue of 3 2 n (mod F m ) is described by listing its 12 least significant octal digits, and its remainder in octal modulo 2 36  - 1 and modulo 2 35  - 1.

    Early in 1962, again partly because of available standy time, the Mersenne program, modified to check modulo 2 35  - 1, was run for all 2 p  - 1 for which no factor was known, with 5000 < p < 6000. No primes were found. As in Hurwitz [1], the five least significant octal digits of S p - 1 are listed in Table 2.

    The results for p < 3300, mentioned by Hurwitz [1], have all been checked against the corresponding SWAC [5] and BESK [4] results. Reruns confirmed four 7090 errors, four BESK errors (2957, 2969, 3049 and 3109), and an incorrect SWAC result for 1889. The SWAC (October 1962) confirmed the 7090 residue.

UCLA Computing Facility
University of California, Los Angeles

    1. ALEXANDER HURWITZ, "New Mersenne primes," Math. Comp., v. 16, 1962, p. 249-251.
    2. A. HURWITZ & J. L. SELFRIDGE, "Fermat numbers and perfect numbers," Notices Amer. Math. Soc., v. 8, 1961, p. 601, abstract 587-104.
    3. G. A. PAXSON, "The compositeness of the thirteenth Fermat number," Math. Comp., v. 15, 1961, p. 420.
    4. HANS RIESEL, "Mersenne numbers," MTAC, v. 12, 1958, p. 207-213.
    5. RAPHAEL M. ROBINSON, "Mersenne and Fermat numbers," Proc. Amer. Math. Soc., v. 5, 1954, p. 842-846.


    Received August 12, 1963. The preparation of this paper was sponsored by the Office of Naval Research.