Compositeness tests for generalized repunit numbers

elementary-number-theoryexamples-counterexamplesprimality-testprime numbers

Can you provide proofs or counterexamples for the following two claims:

First claim

Let $P_m(x)=2^{-m}\cdot((x-\sqrt{x^2-4})^m+(x+\sqrt{x^2-4})^m)$ .
Let $M_p(a)= \frac{a^p-1}{a-1} $ where $a$ is a natural number greater than one and $p$ is an odd prime number . Let $c$ be a natural number greater than two such that $\left(\frac{c-2}{M_p(a)}\right)=\left(\frac{c+2}{M_p(a)}\right)=1$ where $\left(\frac{}{}\right)$ denotes Jacobi symbol. Let $S_i=P_a(S_{i-1})$ with $S_0 =P_{a}(c)$. Then , if $M_p(a)$ is prime then $S_{p-1} \equiv P_{a}(c) \pmod{M_p(a)}$ .

You can run this test here .

Second claim

Let $P_m(x)=2^{-m}\cdot((x-\sqrt{x^2-4})^m+(x+\sqrt{x^2-4})^m)$ .
Let $N_p(b)= \frac{b^p+1}{b+1} $ where $b$ is a natural number greater than one and $p$ is an odd prime number . Let $c$ be a natural number greater than two such that $\left(\frac{c-2}{N_p(b)}\right)=\left(\frac{c+2}{N_p(b)}\right)=1$ where $\left(\frac{}{}\right)$ denotes Jacobi symbol. Let $S_i=P_b(S_{i-1})$ with $S_0 =P_{b}(c)$. Then , if $N_p(b)$ is prime then $S_{p-1} \equiv P_{b}(c) \pmod{N_p(b)}$ .

You can run this test here .

I have verified these claims for many random values from this list .

Best Answer

The two claims are true.

Proof for the first claim :

First of all, let us prove by induction on $i$ that $$S_i=2^{-a^{i+1}}(s^{a^{i+1}}+t^{a^{i+1}})\tag1$$ where $s:=c-\sqrt{c^2-4},t:=c+\sqrt{c^2-4}$.

For $i=0$, $(1)$ holds since

$$S_0 =P_{a}(c)=2^{-a}(s^a+t^a)$$

Supposing that $(1)$ holds for $i$ gives $$\begin{align}S_{i+1}&=P_a(S_i) \\\\&=2^{-a}\bigg(\bigg(2^{-a^{i+1}}(s^{a^{i+1}}+t^{a^{i+1}})-\sqrt{(2^{-a^{i+1}}(s^{a^{i+1}}+t^{a^{i+1}}))^2-4}\bigg)^a \\&\qquad\qquad +\bigg(2^{-a^{i+1}}(s^{a^{i+1}}+t^{a^{i+1}})+\sqrt{(2^{-a^{i+1}}(s^{a^{i+1}}+t^{a^{i+1}}))^2-4}\bigg)^a\bigg) \\\\&=2^{-a}\bigg(\bigg(2^{-a^{i+1}}(s^{a^{i+1}}+t^{a^{i+1}})-\sqrt{(2^{-a^{i+1}}(t^{a^{i+1}}-s^{a^{i+1}}))^2}\bigg)^a \\&\qquad\qquad +\bigg(2^{-a^{i+1}}(s^{a^{i+1}}+t^{a^{i+1}})+\sqrt{(2^{-a^{i+1}}(t^{a^{i+1}}-s^{a^{i+1}}))^2}\bigg)^a\bigg) \\\\&=2^{-a}\bigg(\bigg(2^{-a^{i+1}}(s^{a^{i+1}}+t^{a^{i+1}})-2^{-a^{i+1}}(t^{a^{i+1}}-s^{a^{i+1}})\bigg)^a \\&\qquad\qquad +\bigg(2^{-a^{i+1}}(s^{a^{i+1}}+t^{a^{i+1}})+2^{-a^{i+1}}(t^{a^{i+1}}-s^{a^{i+1}})\bigg)^a\bigg) \\\\&=2^{-a^{i+2}}(s^{a^{i+2}}+t^{a^{i+2}})\qquad\square\end{align}$$

Let $N:=M_p(a)=\frac{a^p-1}{a-1}$. Then, from $(1)$, we get, using $2(c\pm\sqrt{c^2-4})=(\sqrt{c+2}\pm\sqrt{c-2})^2$, $$\begin{align}S_{p-1}&=2^{-(a-1)N-1}(s^{(a-1)N+1}+t^{(a-1)N+1}) \\\\&=2^{-(a-1)N-1}(s\cdot s^{(a-1)N}+t\cdot t^{(a-1)N}) \\\\&=2^{-2(a-1)N-1}\bigg(s((\sqrt{c+2}-\sqrt{c-2})^{N})^{2(a-1)} \\&\qquad\qquad\qquad\qquad+t((\sqrt{c+2}+\sqrt{c-2})^{N})^{2(a-1)}\bigg)\tag2\end{align}$$

Here, we have, by the binomial theorem, $$\begin{align}&(\sqrt{c+2}\pm\sqrt{c-2})^{N} \\\\&=\sum_{k=0}^{N}\binom Nk(\sqrt{c+2})^{N-k}(\pm\sqrt{c-2})^k \\\\&=\sqrt{c+2}\sum_{j=0}^{(N-1)/2}\binom{N}{2j}(c+2)^{(N-2j-1)/2}(c-2)^{j} \\&\qquad\qquad\qquad\qquad \pm\sqrt{c-2}\sum_{j=1}^{(N+1)/2}\binom{N}{2j-1}(c+2)^{(N-2j+1)/2}(c-2)^{j-1}\end{align}$$

So, there are integers $C,D$ such that $$(\sqrt{c+2}\pm\sqrt{c-2})^{N}=C\sqrt{c+2}\pm D\sqrt{c-2}\tag3$$ where $$C=\sum_{j=0}^{(N-1)/2}\binom{N}{2j}(c+2)^{(N-2j-1)/2}(c-2)^{j}\equiv \left(\frac{c+2}{N}\right)\equiv 1\pmod N\tag4$$ and $$D=\sum_{j=1}^{(N+1)/2}\binom{N}{2j-1}(c+2)^{(N-2j+1)/2}(c-2)^{j-1}\equiv \left(\frac{c-2}{N}\right)\equiv 1\pmod N\tag5$$

It follows from $(2)(3)(4)(5)$ and $2^{N-1}\equiv 1\pmod N$ that $$\begin{align}2^{(2a-2)(N-1)}\cdot S_{p-1}&=2^{-2a+1}\bigg(s((\sqrt{c+2}-\sqrt{c-2})^{N})^{2(a-1)} \\&\qquad\qquad\qquad\qquad+t((\sqrt{c+2}+\sqrt{c-2})^{N})^{2(a-1)}\bigg) \\\\&=2^{-2a+1}\bigg(s(C\sqrt{c+2}- D\sqrt{c-2})^{2(a-1)} \\&\qquad\qquad\qquad\qquad+t(C\sqrt{c+2}+ D\sqrt{c-2})^{2(a-1)}\bigg) \\\\&\equiv 2^{-2a+1}\bigg(s(\sqrt{c+2}- \sqrt{c-2})^{2(a-1)} \\&\qquad\qquad\qquad\qquad+t(\sqrt{c+2}+\sqrt{c-2})^{2(a-1)}\bigg)\pmod N \\\\&\equiv 2^{-a}(s^a+t^a)\pmod N \\\\&\equiv P_{a}(c)\pmod{M_p(a)} \end{align}$$ from which $$S_{p-1}\equiv P_a(c)\pmod{M_p(a)}$$follows.$\quad\blacksquare$


Proof for the second claim :

Let $N:=N_p(b)= \frac{b^p+1}{b+1}$. Then, from $(1)$, we get, similarly as above, $$\begin{align}2^{2(b+1)(N-1)}\cdot S_{p-1}&=2^{(b+1)N-2b-1}(s^{(b+1)N-1}+t^{(b+1)N-1}) \\\\&=2^{-2b-3}\bigg(t\cdot ((\sqrt{c+2}-\sqrt{c-2})^N)^{2(b+1)} \\&\qquad\qquad\qquad\qquad +s\cdot ((\sqrt{c+2}+\sqrt{c-2})^N)^{2(b+1)}\bigg) \\\\&\equiv 2^{-2b-3}\bigg(t\cdot (\sqrt{c+2}-\sqrt{c-2})^{2(b+1)} \\&\qquad\qquad\qquad\qquad +s\cdot (\sqrt{c+2}+\sqrt{c-2})^{2(b+1)}\bigg)\pmod N \\\\&\equiv 2^{-2b}\bigg((\sqrt{c+2}-\sqrt{c-2})^{2b}+(\sqrt{c+2}+\sqrt{c-2})^{2b}\bigg)\pmod N \\\\&\equiv 2^{-b}(s^{b}+t^{b})\pmod N \\\\&\equiv P_b(c)\pmod N\end{align}$$ from which $$S_{p-1}\equiv P_b(c)\pmod{N_p(b)}$$ follows.$\quad\blacksquare$

Related Question