Mr Pocklington, Prime or Composite Numbers 29 
The Determination of the Prime or Composite Nature of Large 
Numbers by Fermat's Theorem. By H. C. Pock.ineron, M.A., 
St John’s College. 
i 
f 
{ [Read 9 March 1914. ] 
1. Probably the best way to find out whether a large number 
WV is composite is to take some number w and find the least 
residue of 27 to modulus NV. Of course we first raise 7 to powers 
the indices of which are powers of 2 by repeated squaring and 
division by the modulus to find the remainder, and then multiply 
‘numbers chosen from the results so that their indices add up to 
N-1. If #~ is not =1 mod. N we infer from Fermat’s Theorem 
that Vis composite. The object of this paper is to explain how 
to proceed if we find that 2” =1 mod. WV. 
! 2. Let p be a prime divisor (preferably the largest) of NV —1, 
contained «@ times in it, and let (V¥—1)/p=m. We now find the 
remainder of 2” to divisor NV by the method already given. If 
the remainder is not unity we subtract 1 from it and find the 
greatest common divisor 6 of the result and V. If 6+1 we have 
of course found a factor 6 of V. If 8=1 we see that v”—1 is 
not divisible by any prime divisor of N. Hence the exponent to 
which « belongs with respect to any prime divisor 7 of VV, which 
we have found to divide NV — 1, does not divide (NW —1)/p. Hence 
it contains p* as a factor. But m—1 is divisible by this ex- 
ponent. Hence 7—1 is divisible by p*%, so that all the prime 
divisors of N are of the form kp*+1. If now p” is greater than 
VN this shows that N has no divisor less than its square root, so 
that NV must be prime. If pis not too many times smaller than 
/N we shall only have to try a comparatively small number of 
possible divisors. If p* is too small we proceed in the same way 
with another prime factor g of NV, and will probably succeed in 
finding a factor of NV or in showing that every prime divisor of NV 
is of the form kp%q? + 1. 
It may happen* that #”"=1 mod. N. In this case we take 
any prime factor q of m (preferably the largest) and proceed just 
as before with m replaced by m/q. It can happen that « belongs 
to a small exponent with respect to NV, for example 2 belongs to 
exponent p, modulus 2?—1. In such a case we can only take a 
new value of x. We can of course, after proving that JN is prime, 
continue the process and find the exponent to which # belongs 
with respect to NV. 
* This can only happen rarely, for if N is prime the number of distinct values 
of « for which this happens is only 1/p of their number. 
