Can you provide proof or counterexample for the claim given below?
Inspired by Lucas-Lehmer primality test I have formulated the following claim:
Let $P_m(x)=2^{-m}\cdot((x-\sqrt{x^2-4})^m+(x+\sqrt{x^2-4})^m)$ . Let $N= 4 \cdot 3^{n}-1 $ where $n\ge3$ . Let $S_i=S_{i-1}^3-3 S_{i-1}$ with $S_0=P_9(6)$ . Then $N$ is prime if and only if $S_{n-2} \equiv 0 \pmod{N}$ .
You can run this test here .
Numbers $n$ such that $4 \cdot 3^n-1$ is prime can be found here .
I was searching for counterexample using the following PARI/GP code:
CE431(n1,n2)=
{
for(n=n1,n2,
N=4*3^n-1;
S=2*polchebyshev(9,1,3);
ctr=1;
while(ctr<=n-2,
S=Mod(2*polchebyshev(3,1,S/2),N);
ctr+=1);
if(S==0 && !ispseudoprime(N),print("n="n)))
}
EDIT After few years I finally found correct formulation of criterion. I have a proof but it is too long. Here is criterion:
Let $N= 4 \cdot 3^{n}-1 $ where $n\ge 0$ . Let $S_i=S_{i-1}^3-3 S_{i-1}$ with $S_0=6$ .If $S_{n-1} \equiv \pm 2 \cdot 3^{\frac{n+1}{2}} \pmod N$ then $N$ is prime if and only if $S_{n} \equiv 0 \pmod{N}$
EDIT 2
Possible generalization:
Let $N= 4 \cdot p^n-1$ , where $n \ge 1$ and $p$ is an odd prime. Let $S_i=D_p(S_{i-1},1)$ with $S_0=6$ , where $D_n(x,1)$ denotes nth Dickson polynomial.If $\operatorname{gcd}(S_{n-1},N)=1$ then $N$ is prime if and only if $S_{n} \equiv 0 \pmod{N}$ .