# $s(n) = a_1 p_1^n + \dots + a_k p_k^n + a_{k + 1}$ is a perfect square for every $n$, prove that $a_1 = a_2 = \dots = a_k = 0$ & $a_{k + 1}$ a square

Let $$p_1 < p_2 < \dots < p_k$$ prime numbers. If $$a_i$$, with $$i = \overline{1, k + 1}$$ are natural numbers with: $$S(n) = a_1 p_1^n + \dots + a_k p_k^n + a_{k + 1}$$ a number that is a perfect square for every value of $$n \in \mathbb{N}^*$$.
Prove that each of the numbers $$a_1, a_2, \dots, a_k$$ are $$0$$, while $$a_{k + 1}$$ is a perfect square.

A sort of attempt:

Let's consider a simpler case, like $$k = 1$$. We have $$a_1 = a$$ and $$a_2 = b$$, while $$p_1 = p$$ and we will obtain: $$ap^n + b$$ is a perfect square for each $$n$$.

Which is actually impossible if $$a \neq 0$$, a well-known property.

So, I'm thinking at induction, but the problem actually seems extremely difficult, because prime number set does not have the induction principle associated, unlike the naturals, so the only inductions that may be viable are those made after $$k$$, but adding a prime to the equation seems pretty unrelated to the previous case. Any help would be appreciated.

• HINT.-Let $\alpha$ be a primitive root of the larger prime $p_k$ so we have for all $n$ $$a_1(\alpha^{m_1})^n+\cdots+a_{k-1}(\alpha^{m_{k-1}})^n+a_kp_k^n+a_{k+1}=x_n^2$$ from which for all $n$ $$a_kp_k^n+a_{k+1}\equiv x_n^2\pmod\alpha$$ which according a light modification of your first attemp implies $a_k=0$ and $a_{k+1}$ a constant square. You can now repeat the procedure with the other values of the involved primes. Nov 18, 2021 at 15:42
• @Piquito I haven't managed to prove more than the fact that $\alpha \ | \ a_k$ and $a_{k + 1}$ is a quadratic residue mod $\alpha$. How to switch to the general case and to 'escape' modular relations? Thanks a lot for your observations! Nov 20, 2021 at 5:50
• Actually, could you please explain why $ap^n+b$ can't be all perfect squares? Nov 20, 2021 at 18:45
• @MathStackExchange: You are welcome. Regards. Nov 21, 2021 at 4:56

We will use proof by contradiction to show that all $$a_{1},...,a_{k}$$ are $$0$$.

W.L.O.G we may assume $$a_{k}$$ is non-zero .

Let $$d$$ be the largest integer $$\geq 0$$ so that $$p_{k}^{d}|a_{k}$$.

Consider $$S(-d-1) = a_{k+1}+\sum_{j=1}^{k}a_{j}p_{j}^{-d-1}$$

Note that $$S(-d-1)$$ is of the form $$\frac{u}{v}$$ with $$\gcd(u,v) = 1$$, $$p_{k}|v$$ and $$p_{k}^2$$ does not divide $$v$$. Also observe that $$S(-d-1)$$ is a quadratic residue modulo each prime $$q$$ where $$q \neq p_{j}$$ ($$j = 1,...,k$$) as if we choose $$t \in \mathbb{N}$$ so that $$-d-1+(q-1)t \geq 1$$ we have

$$S(-d-1)\equiv a_{k+1}+\sum_{j=1}^{k}a_{j}p_{j}^{-d-1} \equiv a_{k+1}+\sum_{j=1}^{k}a_{j}p_{j}^{-d-1+(q-1)t} \equiv S(-d-1+(q-1)t) \mod q$$

Since $$S(-d-1+(q-1)t)$$ is a square, $$S(-d-1)$$ is a square $$\mod q$$ by the above modular equation.

Thus if we show that $$S(-d-1) =\frac{u}{v}$$ is not a quadratic residue modulo some prime $$q \neq p_{j}$$ $$(j = 1,...,k)$$ we will have a contradiction. We will obtain this contradiction when we use the quadratic reciprocity theorem and Dirichlet's theorem of primes in arithmetic progressions. Let us continue the proof;

Note that by the above discussion we can perform prime factorization on the numerator and denominator of $$S(-d-1)$$

$$S(-d-1) = \frac{u}{v} = \frac{(\text{square})r}{(\text{square})sp_{k}}$$

where $$r$$ and $$s$$ are square-free and $$p_{k}$$ is coprime to all primes in the numerator and denominator with the exception of itself. By quadratic reciprocity theorem there exists $$\alpha_{r},\alpha_{s},\alpha_{k}$$ with $$(\alpha_{r},r) = 1$$, $$(\alpha_{s},s) = 1$$ and $$(\alpha_{k},p_{k})=1$$ so that if a prime $$q$$ which satisfies

$$q \equiv \alpha_{r} \mod r$$

$$q \equiv \alpha_{s} \mod s$$

$$q \equiv \alpha_{k} \mod k$$

$$q \equiv 1 \mod \frac{\prod_{j=1}^{k}p_{j}}{\gcd(rsp_{k},\prod_{j=1}^{k}p_{j})}$$

then $$S(-d-1)$$ is not a quadratic residue modulo $$q$$. But primes such as $$q$$ exist due to Chinese remainder theorem (we can solve the above congruence with solution $$\alpha \mod \beta$$ with $$(\alpha,\beta) = 1$$) and Dirichlet's theorem on primes in arithmetic progression. This is a contradiction as this would mean $$S(-d-1+(q-1)t)$$ is never a square whenever $$t \in \mathbb{Z}$$.