6

This question is closely related to: Conjectured primality test

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

Conjecture. Let $n$ be a natural number greater than $2$. Then $n$ is prime if and only if

$$\sum_{k=1}^{n-1}\left(3^k-2\right)^{n-1} \;\equiv\; n \cdot 2^{n-1}-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,
s=sum(k=1,n-1,lift(Mod(3^k-2,(3^n-1)/2)^(n-1)));
if((Mod(s,(3^n-1)/2)==n*2^(n-1)-1),print("n="n)))
}
CE2(n1,n2)=
{
forprime(n=n1,n2,
s=sum(k=1,n-1,lift(Mod(3^k-2,(3^n-1)/2)^(n-1)));
if(!(Mod(s,(3^n-1)/2)==n*2^(n-1)-1),print("n="n)))
}

REMARK

More generally we can formulate the following criterion :

Let $b$ , $a$ and $n$ be a natural numbers, $b>a\geq 1$, $n>2$ and $n \not\in \{4,8,9\}$. Then $n$ is prime if and only if $$\displaystyle\sum_{k=1}^{n}\left(b^k\pm a\right)^{n-1} \equiv n \cdot a^{n-1} \pmod{\frac{b^n-1}{b-1}}$$

Pedja
  • 13,292

1 Answers1

0

The general formula is not true.

For $1 \leq a < b < 20$ and $10 \leq n \leq100$ exceptions (i.e. values for $n$ for which the formula does not correctly state whether $n$ is prime) are:

a b [exceptions (as values for n)]
5 6 [11, 13]
6 7 [11, 13, 17, 19]
7 8 [11, 13, 17, 19, 23]
8 9 [11, 13, 17, 19, 23]
8 10 [11]
9 10 [11, 13, 17, 19, 23, 29, 31]
9 11 [11, 13]
10 11 [11, 13, 17, 19, 23, 29, 31, 37]
10 12 [11, 13]
11 12 [11, 13, 17, 19, 23, 29, 31, 37, 41, 43]
11 13 [11, 13, 17]
12 13 [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
12 14 [11, 13, 17, 19]
12 15 [11]
13 14 [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53]
13 15 [11, 13, 17, 19]
13 16 [11, 13]
14 15 [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59]
14 16 [11, 13, 17, 19, 23]
14 17 [11, 13]
15 16 [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61]
15 17 [11, 13, 17, 19, 23]
15 18 [11, 13]
16 17 [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]
16 18 [11, 13, 17, 19, 23, 29]
16 19 [11, 13, 17]
17 18 [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73]
17 19 [11, 13, 17, 19, 23, 29, 31]
18 19 [11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79]

Revealing some interesting patterns (and maybe a lower limit for the correctness of the formula). Also, interestingly, these values are all prime. However, taking $a=3$ and $b=4$ (this time with the $+$ sign) we get the counter-example $25$, a non-prime. In my very limited search I have found no other non-prime counter-examples greater than $10$. Also, all counter-examples seem to be powers of primes.

And yes, this does not directly help your original question with $b=3$ and $a=2$.