64 History of the Theory of Numbers. [Chap, ill 
From the (p — l)th order of differences for x""^ — 1, 
{x+p-ir-'-i-{p-i)\{x-\-p-2r-'-i\ + (^p~^y,{x-{-p-sr-'-i\ 
Set x = l and use Fermat's theorem. Hence l + (p — 1)! is divisible by p. 
E. Waring/^ 1782, 380-2, made use of 
x' = xix-l). . .{x-r-{-l)-\-Pxix-l). . .(x-r+2) 
+Qxix-1) . . .(x-r+3)+ . . . +Hx(x-l)+Ix, 
where P = H-2+ • • . -f (r — 1), Q = PA^—B, etc., B denoting the sum of the 
products of 1, 2,..., r — 1 two at a time, and A^ = l+2+ . . . +(r— 2). 
Then 
r+2'+ . . .+x^ = -^{x+l)x{x-l) . . .ix-r+l)+-{x+l)x. ..{x-r+2) 
r+1 r 
+-^(x+l)x. ..{x-r+3)+. . . +^ix+l)x{x-l)-\-Ux+l)x. 
Take r = x and let x+1 be a prime. By Fermat's theorem, V, 2"^, . . ., x' 
each has the remainder unity when divided by x+1, so that their sum has 
the remainder x. Thus l+x\ is divisible by x+1. 
Genty^^ proved the converse of Wilson's theorem and noted that an 
equivalent test for the primahty of p is that p divide (p— n)!(n — 1)! — 
( - 1)". For n = (p+ 1)/2, the latter expression is \ (^zi) !^ 2± i [Lagrange^^]. 
Franz von Schaffgotsch^^ was led by induction to the fact (of which he 
gave no proof) that, if n is a prime, the numbers 2, 3, . . . , n — 2 can be paired 
so that the product of the two in any pair is of the form xn+1 and the two 
of a pair are distinct. Hence, by multipUcation, 2-3...(n — 2) has the 
remainder unity when divided by n, so that (n — 1)! has the remainder 
n — 1. For example, if n = 19, the pairs are 2-10, 4-5, 3-13, 7-11, 6-16, 
8-12, 9-17, 14-15. Similarly, for n any power of a prime p, we can so 
pair the integers <n — l which are not divisible by p. But for n=15, 4 
and 4 are paired, also 1 1 and 1 1 . Euler^^ had already used these associated 
residues (residua sociata). 
F. T. Schubert^^" proved by induction that the nth order of differences 
of r, 2",....isn!. 
A. M. Legendre-^ reproduced the second proof by Euler^^ of Fermat's 
theorem and used the theory of differences to prove (2) for a = x. Taking 
a; = p — 1 and using Fermat's theorem, we get (p — 1)!=(1 — 1)" — 1 (mod p). 
"Histoire et m6m. de I'acad. roy. sc. insc. de Toulouse, 3, 1788 (read Dec. 4, 1783), p. 91. 
"Abhandlungen d. Bohmischen Gesell. Wiss., Prag, 2, 1786, 134. 
"Opusc. anal., 1, 1783 (1772), 64, 121; Novi Comm. Ac. Petrop., 18, 1773, 85, §26; Comm. 
Arith. 1, 480, 494, 519. 
""Nova Acta Acad. Petrop., 11, ad annum 1793, 1798, mem., 174-7. 
"Th6orie des nombres, 1798, 181-2; ed. 2, 1808, 166-7. 
