This is a repost of this question.

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)))
}
```

P.S.

Partial answer can be found here.