Wilson's theorem states that an integer is prime if and only if . For a prime , every nonzero residue has a multiplicative inverse. Pair each residue with its inverse; the only self-inverse ones satisfy in and hence are (the same residue when ). The resulting product is . Conversely, if , no divisor of can satisfy : it would divide both and , so could not divide . Hence is prime.
For a composite which is not the square of a prime, choose a proper factorization with if possible. Both factors occur in , proving divisibility by . If the initially chosen factors coincide but their common value is composite, choose a different proper divisor to obtain unequal factors; equivalently, the only composite integer all of whose proper nontrivial divisors coincide is a prime square. For , the distinct factors and lie below and their product is divisible by . Thus for every composite .
For a prime , write . Then , so the summand is one. For a composite it is zero. The only remaining composite index is four, whose summand equals . Therefore the sum is the prime-counting function plus two whenever ; subtraction of two gives the claimed exact formula.
Articles by others on the same topic
There are currently no matching articles.