62 History of the Theory of Numbers. [Chap, hi 
E. Waring^^ first published the theorem that [Leibniz®] l + (p — 1)! is 
divisible by the prime p, ascribing it to Sir John Wilson^^ (1741-1793). 
Waring (p. 207; ed. 3, p. 356) proved that if a^ — a is divisible by p, then 
(a+1)''— a — 1 is, since {a+iy = a^-\-pA-\-l, "a, property first invented by 
Dom. Beaufort and first proved by Euler." 
J. L. Lagrange^^ was the first to publish a proof of Wilson's theorem. Let 
(x+l)(x+2) . . . (x+p-l) =x''-^+AiX^-'+ . . . -h^p-i. 
R eplace x by x + 1 and multiply the resulting equation by x + 1 . Comparing 
with the original equation multiplied by x+p, we get 
{x+p){x^-'+. . . +A,_,) = {x+ir+Ai{x+ir-' + . . . +^p_i(x+l). 
Apply the binomial theorem and equate coefl5cients of like powers of x. 
Thus 
Let p be a prime. Then, for 0<k<p, (j) is an integer divisible by p. 
Hence Ai, 2A2, . . . , {p—2)Ap_2 are divisible by p. Also, 
(P-1)4,..= (P + (PI})A:+(P-2)^+... = 1+^+A,+ ...+^,.2. 
Thus 1+Ap_i is divisible by p. By the original equation, Ap_i = (p — 1)!, 
so that Wilson's theorem follows. 
Moreover, if x is any integer, the proof shows that 
xP-^-l-(x+l)(x+2)...(x+p-l) 
is divisible by the prime p. If x is not divisible by p, some one of the 
integers x+1,. . .,x+p — 1 is divisible by p. Hence x''"^ — 1 is divisible by 
p, giving Fermat's theorem. 
Lagrange deduced Wilson's theorem from Fermat's. By the formula^* 
for the differences of order p — 1 of P~\ . . ., n^~^, 
(1) (p-i)\=p^-'-{p-i){p-iy-'+(^p~^){p-2r-' 
-(^3^)(p-3)^-^+. . .+(-1)^-^ 
Dividing the second member by p, and applying Fermat's theorem, we 
obtain the residue 
"Meditationes algebraicae, Cambridge, 1770, 218; ed. 3, 1782, 380. 
"On his biography see Nouv. Corresp. Math., 2, 187.6, 110-114; M. Cantor, Bibliotheca math., 
(3), 3, 1902, 412; 4, 1903, 91. 
"Nouv. M6m. Acad. Roy. BerUn, 2, 1773, ann^e 1771, p. 125; Oeuvres, 3, 1869, 425. Cf. N. 
Nielsen, Danske Vidensk. Selsk. Forh., 1915, 520. 
"Euler, Novi Comm. Ac. Petrop., 5, 1754-5, p. 6; Comm. Arith., 1, p. 213; 2, p. 532; Opera 
postuma, Petropoli, 1, 1862, p. 32. 
