In mathematics, Wolstenholme's theorem states that for a prime number , the congruence holds, where the parentheses denote a binomial coefficient. For example, with p = 7, this says that 1716 is one more than a multiple of 343. The theorem was first proved by Joseph Wolstenholme in 1862. In 1819, Charles Babbage showed the same congruence modulo p2, which holds for . An equivalent formulation is the congruence for , which is due to Wilhelm Ljunggren (and, in the special case , to J. W. L. Glaisher) and is inspired by Lucas' theorem. No known composite numbers satisfy Wolstenholme's theorem and it is conjectured that there are none (see below). A prime that satisfies the congruence modulo p4 is called a Wolstenholme prime (see below). As Wolstenholme himself established, his theorem can also be expressed as a pair of congruences for (generalized) harmonic numbers: (Congruences with fractions make sense, provided that the denominators are coprime to the modulus.) For example, with p=7, the first of these says that the numerator of 49/20 is a multiple of 49, while the second says the numerator of 5369/3600 is a multiple of 7. Wolstenholme primes A prime p is called a Wolstenholme prime iff the following condition holds: If p is a Wolstenholme prime, then Glaisher's theorem holds modulo p4. The only known Wolstenholme primes so far are 16843 and 2124679 ; any other Wolstenholme prime must be greater than 109. This result is consistent with the heuristic argument that the residue modulo p4 is a pseudo-random multiple of p3. This heuristic predicts that the number of Wolstenholme primes between K and N is roughly ln ln N − ln ln K. The Wolstenholme condition has been checked up to 109, and the heuristic says that there should be roughly one Wolstenholme prime between 109 and 1024. A similar heuristic predicts that there are no "doubly Wolstenholme" primes, for which the congruence would hold modulo p5. A proof of the theorem There is more than one way to prove Wolstenholme's theorem. Here is a proof that directly establishes Glaisher's version using both combinatorics and algebra. For the moment let p be any prime, and let a and b be any non-negative integers. Then a set A with ap elements can be divided into a rings of length p, and the rings can be rotated separately. Thus, the a-fold direct sum of the