Can you provide proof or counterexample for the claim given below?
Inspired by Lucas-Lehmer-Riesel 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= k \cdot 3^{n}-1 $ where $k$ is a positive even natural number , $ k<2^n$ and $n\ge3$ . Let $a$ be a natural number greater than two such that $\left(\frac{a-2}{N}\right)=1$ and $\left(\frac{a+2}{N}\right)=-1$ where $\left(\frac{}{}\right)$ denotes Jacobi symbol. Let $S_i=S_{i-1}^3-3 S_{i-1}$ with $S_0$ equal to the modular $P_{9k/2}(a)\phantom{5} \text{mod} \phantom{5} N$. Then $N$ is prime if and only if $S_{n-2} \equiv -2 \pmod{N}$ .
You can run this test here .
I was searching for counterexample using the following PARI/GP code:
CEk31(k1,k2,n1,n2)=
{
forstep(k=k1,k2,[2],
for(n=n1,n2,
if(k<2^n,
N=k*3^n-1;
a=3;
while(!(kronecker(a-2,N)==1 && kronecker(a+2,N)==-1),a++);
S=Mod(2*polchebyshev(9*k/2,1,a/2),N);
ctr=1;
while(ctr<=n-2,
S=Mod(2*polchebyshev(3,1,S/2),N);
ctr+=1);
if(S==N-2 && !ispseudoprime(N),print("k="k,"n="n)))))
}