# Determining number of integer solutions for expression of perfect square

How many positive integer values of n are there such that $$2^n + 7^n$$ is a perfect square?

I am not sure how to approach this question given that there are two different bases 2 and 7

• Reduce this sequence modulo a suitable quantity. – Allawonder Sep 11 at 12:50

The only instance is $$n=1$$.

Let $$a_n=2^n+7^n$$.

Of course $$a_1$$ is a square. Assume that $$n>1$$.

We see that $$a_n\equiv (-1)^n \pmod 4$$ so $$n$$ must be even (this is where we use $$n>1$$).

Similarly we see that $$a_n\equiv 2^{n+1}\pmod 5$$ which implies that $$n$$ is odd, and we are done

Set $$2^n+7^n=x^2$$. Since all perfect squares are congruent to $$0$$ or $$1$$ modulo $$3$$ . On the other hand $$7^n\equiv 1\pmod 3$$ and $$2^n\equiv 1\pmod 3$$ or $$2^n\equiv 2\pmod 3$$ .This means that $$n$$ must be odd(why?). Proof by Contradiction: We wish to show that the only value of $$n$$ is $$1$$. Assume that $$n>2$$. Then consider the equation $$2^n=x^2-7^n$$. let $$x=2a+1$$. We have $$2^n=4a^2+4a+1-7^n$$. Dividing by $$4$$, $$2^ {n-2}=a^2+a+(1-7^n)/4$$. the entire LHS is an integer, and so are $$a^2$$ and $$a$$. Thus, $$\dfrac {1}{4} (1 - 7^n)$$ must be an integer. Let $$\dfrac {1}{4} (1 - 7^n) = k$$.

Then we have $$1- 7^n = 4k$$. This means that $$1- 7^n \equiv 0 \pmod {4}$$. Thus, $$n$$ is even. However, it has already been shown that $$n$$ must be odd. This is a contradiction. Therefore, $$n$$ is not greater than or equal to $$2$$, and must hence be less than $$2$$. The only positive integer less than $$2$$ is $$1$$

If $$n=2m$$, $$2^{2m}+7^{2m}$$ is too close to the square of $$7^m$$ to be a square itself. This gives that $$n$$ is odd.
If we consider $$n=2m+1$$ for $$m\geq 1$$ (the case $$n=1$$ leads to a trivial solution) we have that $$2^n+7^n = 2\cdot 4^m + (8-1)^{2m+1} \equiv (-1)^{2m+1} \equiv -1\pmod{4},$$ so $$2^n+7^n$$ cannot be a square (a square $$\!\!\pmod{4}$$ is either $$0$$ or $$1$$).
It follows that the trivial solution is the only solution.

This the first attempted solution not only on this post but also my overall first:I can only give you a start with this answer.

N can take either an even value or an odd value. Im attempting only one part-easier one.

Case I(N is even)

The last digit of powers of 2 and 7 repeat in groups of four i.e (2,4,8,6) and (7,9,3,1).For N=4k+2 and N=4k both the last digit of the overall expression turns out to be (4+9=)3 and (6+1=)7,both of which can never be last digits of a perfect square.

(or)

Simply take modulo 3 when n is even,which tells us that the whole expression is 2(mod 3),never a perfect square.

Ill try to complete it soon.(Sorry for not using LaTex as my knowledge of it is non existent.)