62 HISTORY or THE THBOKT OF NUMBERS. [CHAP, in E. Waring16 first published the theorem that [Leibniz6] l+(p~ 1)1 is divisible by the prime p, ascribing it to Sir John Wilson17 (1741-1793). Waring (p. 207; ed. 3, p. 356) proved that if ap a is divisible by p, then (a+l)pa 1 is, since (a+l)p=ap+pA+l, "a property first invented by Dom. Beaufort and first proved by Euler." J. L. Lagrange18 was the first to publish a proof of Wilson's theorem. Let (*+l)(x+2) . . . (aH-p- 1) =af-l+AiaT*+ . . . +AP^. Replace x by x+l and multiply the resulting equation by x+1. Comparing with the original equation multiplied by x+p, we get Apply the binomial theorem and equate coefficients of like powers of x. Thus Let p be a prime. Then, for 0<&<p, (fy is an integer divisible by p. Hence Ai, 2A2, . . . , (p 2) Ap^2 are divisible by p. Also, Thus l+-4.p-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 is divisible by the prime p. If x is not divisible by p, some one of the integers 0;+ 1, . . . , x+p 1 is divisible by p. Hence xv~l 1 is divisible by p, giving Fermat's theorem. Lagrange deduced Wilson's theorem from Fermat's. By the formula19 for the differences of order p 1 of P""1, . . ., n1*"1, (1) (p-i)!=:pp-i-(p Dividing the second member by p, and applying Fermat's theorem, we obtain the residue "Meditationes algebraicae, Cambridge, 1770, 218; ed. 3, 1782, 380. I70nhis biography see Nouv. Corresp. Math., 2, 1876, 110-114; M. Cantor, Bibliotheca math., (3), 3, 1902, 412; 4, 1903, 91. 18Nouv. M&n. Acad. Roy. Berlin, 2, 1773, anne"e 1771, p. 125; Oeuvres, 3, 1869, 425. Cf. N. Nielsen, Danske Vidensk. Selsk. Forh., 1915, 520. "Euler, Novi Comm. Ac. Petrop., 5, 1754r-5, p. 6; Comm. Arith., 1, p. 213; 2, p. 532; Opera postuma, Petropoli, 1, 1862, p. 32.