Fermat Numbers and Mersenne Numbers

By J. L. Selfridge and Alexander Hurwitz

    An IBM 7090 computer program, and results of testing Mersenne numbers Mp = 2p - 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 F14 is composite and that 2p - 1 is composite if 5000 < p < 6000.

    The computer program, originally written with the idea of testing 2n - 1 for n = M13, 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 235 - 1 after each squaring and another after each reduction modulo 2p - 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 32n  modulo  the  Fermat  number  Fm = 22m + 1. When n = 2m - 1 the residue was output, with a result congruent to -1 if and only if Fm is prime.

    After testing the program using F10 (see Robinson [5]), we proceeded to test F14. 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 F13. The result that F14 is composite was announced in [2].

TABLE 1
m n R mod 236 R mod 236 - 1 R mod 235 - 1
7127035100542404 514165207640053153335617
8255531023263263 407614543114344141643032
138191607301005536 611677367012031455470517
1416383622476273512 016631677043161031465216
1720176536764625 415751561367155276133751


TABLE 2
p R p R p R
502335472547917227578315446
507727063550326142581325753
508174607552741614583924031
509967662557334740585137460
511320010558131446585711252
515352273559152563586900764
530940357564121342587952670
533344244564740775587952670
535105171565350244592316616
538754357566957031595332461
540751133568932731598766731
541970701569347014  
544351737570133577  
547152563573707151  
547733022574947641  

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

    The final residues in the testing of F7, F8, F13, and F14, and the residue of 3220 (mod F17), 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 32n (mod F14) where n congruent to 0 (mod 2048), and the complete values of 31024 and 365536 are also on cards in the same format. In Table 1 the residue of 32n (mod Fm) is described by listing its 12 least significant octal digits, and its remainder in octal modulo 236 - 1 and modulo 235 - 1.

    Early in 1962, again partly because of available standy time, the Mersenne program, modified to check modulo 235 - 1, was run for all 2p - 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 Sp - 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.

Return to this paper's entry in Luke's Mersenne Library and Bibliography