Congruence satisfied by primes and only by primes II

179 Views Asked by At

This question is closely related to: Congruence satisfied by primes and only by primes

Can you provide a proof or a counterexample for the following claim :

Let n be a natural number greater than two and $n \neq 4$ . Then n is prime if and only if

$\displaystyle\prod_{k=1}^{n-1}\left(3^k-2\right) \equiv 2^n-1 \pmod{\frac{3^n-1}{2}}$

You can run this test here .

I was searching for a counterexample using the following two PARI/GP programs :

CE1(n1,n2)=
{
forcomposite(n=n1,n2,
if(Mod(prod(k=1,n-1,3^k-2),(3^n-1)/2)==2^n-1,print("n="n)))
}
CE2(n1,n2)=
{
forprime(n=n1,n2,
if(!(Mod(prod(k=1,n-1,3^k-2),(3^n-1)/2)==2^n-1),print("n="n)))
}