Can you provide a proof or a counterexample for the claim given below ? 

Inspired by Agrawal's conjecture in [this paper][1] and by Theorem 4 in [this paper][2] I have formulated the following claim :

> Let $n$ be a natural number greater than two . Let $r$ be the smallest odd prime number such that $r \nmid n$ and $n^2 \not\equiv 1 \pmod r$ . Let $T_n(x)$ be Chebyshev polynomial of the first kind , then $n$ is a prime number if and only if $T_n(x) \equiv x^n \pmod {x^r-1,n}$ .

You can run this test [here][3] .

I have tested this claim up to $5 \cdot 10^4$ and there were no counterexamples .


  [1]: https://www.cse.iitk.ac.in/users/manindra/algebra/primality_v6.pdf
  [2]: http://icm.mcs.kent.edu/reports/1999/chebpol.pdf
  [3]: https://sagecell.sagemath.org/?z=eJyNjEEKwjAQRfeCd5CCMIMpGLssOYJX6MKakkA6CdNQ4-2dFszGjZvhz-f9R6bT_fHAppP7cj5YuMcnkGI05qrYkC05sZ8t8EUjVir4KVd0uAmtf-j-D-Fm9NPOQIphdPbxXpxdZaFVQTxDGbjVqAhbkEy1wdMmFBVlaHZjg993jHOKi89SYf8B4Y1Fnw==&lang=gp