Can you provide a proof or a counterexample for the following claim ?
Let $n$ be an odd natural number greater than one . Let $r$ be the smallest odd prime number such that $r \nmid n$ and $n^2 \not\equiv 1 \pmod r$ . Let $P_n(x)$ be Legendre polynomial , then $n$ is a prime number if and only if $P_n(x) \equiv x^n \pmod {x^r-1,n}$ .
You can run this test here .
I have tested this claim up to $2 \cdot 10^4$ and there were no counterexamples .
See here for more information. This covers the test you are describing, however it is stated as a conjecture, not a primality test.