We observe that
A=r≥0, r even∑(rpn)(p!)rr!(rp)!
and
B=r≥0, r odd∑(rpn)(p!)rr!(rp)!
The empty collection corresponds to r=0 in the summation for A. If ur=(p!)rr!(rp)!, r≥0, then we have
ur+1=(rp+1)(rp+2)⋯
Hence we obtain
(p−1)!ur+1=(rp+1)(rp+2)⋯(rp+p−1)ur.
Reading this modulo p, we get ur+1≡ur(modp), r≥0. Using u0=1, we conclude that ur≡1(modp), for all r≥1. This implies that
A−B≡r≥0∑(−1)r(rpn)(modp).
Thus we need to show that p divides M=∑(−1)r(rpn). Suppose p is odd. Taking f(x)=(1−x)n, and ω to be a primitive p-th root of unity, we see that
k=0∑p−1f(ωk)=k=0∑p−1(1−ωk)n=k=0∑p−1j=0∑n(jn)(−1)jωkj=j=0∑n(jn)(−1)jk=0∑p−1ωkj.
We observe that
k=0∑p−1ωkj={1−ωj1−ωpj=0pif p does not divide jif p divides j.
Thus the above sum reduces to
p{(0n)−(pn)+(2pn)+…}=pM.
However 1,ω,ω2,…,ωp−1 are the roots of xp−1=0. If we set αk=1−ωk, 0≤k≤p−1, then α0,α1,…,αp−1 are the roots of (x−1)p+1=0. If we set cj=(−1)j(jp) for j=1,2,…,p−1, then we have
(x−α0)(x−α1)(x−α2)⋯(x−αp−1)=xp+c1xp−1+c2xp−2+⋯+cp−1x+cp
where we take cp=0. We observe that p divides cj for 0≤j≤p−1. Taking sk=∑j=0p−1αjk, use of Newton's identities show that sk is divisible by p for k≥0. Moreover for n≥p, we also have
sn+c1sn−1+c2sn−2+⋯+cp−1sn−(p−1)+cpsn−p=0.
Thus p2 divides sn. But
sn=j=0∑p−1αjn=j=0∑p−1(1−ωj)n=pM.
It follows that p divides M.
If p is even, then M≡∑j≥0(2jn)≡2n−1(mod2). Since n≥p=2, we conclude that 2 divides M.