A Generalization of a Necessary and Sufficient Condition for Primality Due to Vantieghem

We present a family of congruences which hold if and only if a natural number n is prime. The subject of primality testing has been in the mathematical and general news recently , with the announcement [1] that there exists a polynomial-time algorithm to determine whether an integer p is prime or not. There are older deterministic primality tests which are less efficient; the classical example is Wilson's theorem, that (n − 1)! ≡ −1 mod n (1) if and only if n is prime. Although this is a deterministic algorithm, it does not provide a workable primality test because it requires much more calculation than trial division. This note provides another family of congruences satisfied by primes and only by primes; it is a generalization of previous work. They could be used as examples of primality tests for students studying elementary number theory. In Guy [3, Problem A17], the following result due to Vantieghem [4] is quoted as follows. Theorem 1 (Vantieghem [4]). Let n be a natural number greater than 1. Then n is prime if and only if n−1 d=1 1 − 2 d ≡ n mod 2 n − 1. (2) In this note, we will generalize this result to obtain the following theorem. Theorem 2. Let m and n be natural numbers greater than 1. Then n is prime if and only if n−1 d=1 1 − m d ≡ n mod m n − 1 m − 1. (3) We note that these congruences are also much less efficient than trial division. Proof. We follow the method of Vantieghem, using a congruence satisfied by cy-clotomic polynomials.

The subject of primality testing has been in the mathematical and general news recently, with the announcement [1] that there exists a polynomial-time algorithm to determine whether an integer p is prime or not.
There are older deterministic primality tests which are less efficient; the classical example is Wilson's theorem, that if and only if n is prime. Although this is a deterministic algorithm, it does not provide a workable primality test because it requires much more calculation than trial division. This note provides another family of congruences satisfied by primes and only by primes; it is a generalization of previous work. They could be used as examples of primality tests for students studying elementary number theory.
In Guy [3, Problem A17], the following result due to Vantieghem [4] is quoted as follows.
Theorem 1 (Vantieghem [4]). Let n be a natural number greater than 1. Then n is prime if and only if In this note, we will generalize this result to obtain the following theorem.
Theorem 2. Let m and n be natural numbers greater than 1. Then n is prime if and only if We note that these congruences are also much less efficient than trial division.

Proof.
We follow the method of Vantieghem, using a congruence satisfied by cyclotomic polynomials. Lemma 3 (Vantieghem). Let m be a natural number greater than 1 and let Φ m (X) be the mth cyclotomic polynomial. Then (Here the f i are polynomials over Z.) Let ζ be a primitive mth root of unity. Now, if Y = ζ, then we see that the left-hand side of this expression is identically 0 in X.
This implies that the f i are zero at every ζ and every i.
Suppose that the natural number n in Theorem 2 is prime. Let p := n. We have that We now set X = 1 and Y = m, to get This proves that if p is prime, then the congruence holds. We now prove the converse, by supposing that the congruence (3) holds, and that p is not prime. Therefore p is composite, and hence has a smallest prime factor q. We write p = q · a; now q ≤ a, and also p ≤ a 2 .
Now we have that m a − 1 divides m p − 1 and m a −1 divides the product . By combining this with the congruence (3) in Theorem 2, this implies that (m a − 1)/(m − 1) divides p. Therefore we have The inequality 2 a − 1 ≤ a 2 forces a to be either 2 or 3; this means that p ∈ {4, 6, 9} and m ∈ {2, 3}; one can check by hand that the congruence does not hold in this case, so we have proved Theorem 2.
Guy also asks if there is a relationship between the congruence given by Vantieghem and Wilson's theorem. The following theorem gives an elementary congruence similar to that of Vantieghem between a product over integers and a cyclotomic polynomial. It is in fact equivalent to Wilson's theorem.

Theorem 4. Let m be a natural number greater than 2. Define the product F(X) by
Then m is prime if and only if Proof of Theorem 4. Firstly, we prove that if m is not prime, the congruence (10) in Theorem 4 does not hold.
Recall that φ(m) is defined to be Euler's totient function; the number of integers in the set {1,...,m} which are coprime to m.
We find that the following congruence holds: This follows from the following identity: Because m > 2, φ(m) is divisible by 2, the sum on the left-hand side of (12) is a multiple of m. We now use some theorems to be found in a paper by Gallot [2, Theorems 1.1 and 1.4].
Theorem 5. Let p be a prime and m a natural number.
(1) The following relations between cyclotomic polynomials hold: (2) If m > 1, then p if n is a power of a prime p, From these results, we see that if m is not a prime power, we then have Φ n (1) ≡ 1 mod m, and F(1) is given by We see that this is not congruent to 1 mod m because the product is over those i which are coprime to m, so the product does not vanish modulo m.
If m is a prime power p n , then we see from Theorem 5 that Φ p n (x) = Φ p (x p n−1 ); in particular, we see that the coefficient of x φ(p n )−1 is 0, which differs from the coefficient of Therefore, if m is not prime, then the congruence does not hold. We now show that if m is prime, the congruence holds.
Therefore we have proved Theorem 4.