429 



Mechanical Device for Testing Mersenne Numbers 



for Primes. 



Thos. E. Mason. 



Lucas,* in a note in "Recreations Mathematiques," gives a method 

 of testing numbers of the form 2 q — 1 for primes. The purpose of this 

 note is to show how the labor of that method can be shortened, and how a 

 machine could be constructed which would do most of the labor. If such a 

 machine were constructed the labor of verifying the Mersenne numbers would 

 be reduced to hours where it now requires weeks and months, for example, 

 for numbers like 2 127 — 1. 



Lucas makes use of the following theorem: In order that the number 

 p=2 3 — 1 shall be prime, it is necessary and sufficient that the congruence 



J— 1=2 cos 4q+2 , (mod p), 



shall be satisfied, that is, that 



J^l = V2-t // 2 + l/2+ N l2+T7. , (modp), 

 shall be verified after the successive removal of the radical. In other words, 

 if we form the set of numbers V n , 



V = l, Vi = 3, V 2 = 7, V 3 = 47, V 4 = 2207, . . . , 

 such that each after the second is the square of the preceding diminished 

 by 2 units, and then consider only the residues, modulo p, if the residue of 

 the number V n , where n = 4q+2, is zero the number p is prime. 



The process of Lucas makes use of the binary system of numeration. 

 In this system multiplication consists simply in the longitudinal displacement 

 of the multiplicand. It is evident also that the residue of the division of 

 2 m by 2 n — 1 is equal to 2 r , r designating the residue of the division of m 

 by n; consequently, in trying 2 7 — 1, it is sufficient to operate upon numbers 

 having at most 7 of the figures or 1. Figure I gives the calculation of V 4 

 deduced from the calculation of V 3 by the formula 

 V 4 = V"; — 2 (mod 2 7 - 1); 

 the dark squares represent the units of different orders of the binary system 

 "Lucas, Recreations Mathematiques, Vol. 2, pp. 230-235. 



