# find total integer solutions for $(x-2)(x-10)=3^y$

I found this questions from past year maths competition in my country, I've tried any possible way to find it, but it is just way too hard.

How many integer solutions ($x$, $y$) are there of the equation $(x-2)(x-10)=3^y$?

(A)1 (B)2 (C)3 (D)4 (E)5

If let $y=0$, we had $$x^2 - 12x + 20 = 1$$ $$x^2 - 12x + 19 = 0$$

no integer solution for x

let $y=1$, we had $x^2 - 12x + 17 = 0$, no integer solution too.

let $y=2$, we had $x^2 - 12x + 11 = 0$, we had $x = 1, 11$.

let $y=3$, we had $x^2 - 12x - 7 = 0$, no integer solution.

let $y=4$, we had $x^2 - 12x - 61 = 0$, no integer solution.

and going on....

is there any other efficient way to find it? "brute-forcing" it will wasting a lot of time.

• Use the discriminent: the quadratic $ax^2+bx+c$ will have solutions iff $b^2-4ac\geq 0$. – Bob Krueger Jul 26 '15 at 14:32
• Hint: $x-2$ and $x-10$ are both powers of $3$, possibly decorated with minus signs. – André Nicolas Jul 26 '15 at 14:34
• May I ask where do you find all these interesting problems ? A link would really be appreciated. – Claude Leibovici Jul 26 '15 at 15:22
• @ClaudeLeibovici iium.edu.my/imc/?page_id=46 – wuiyang Jul 26 '15 at 15:32

Since their product is a power of $3$, both $x-2$ and $x-10$ must be powers of $3$, perhaps with minus signs (as Andre Nicolas pointed out). Note, however, that $x-2$ and $x-10$ cannot simultaneously be divisible by $3$. The only power of $3$ which is not divisible by $3$ is $1$, hence we must have that $x-2 = \pm 1$ or $x-10 = \pm 1$.

With this in mind, there are four values of $x$ to try: $1, 3, 9,$ and $11$. Two of these give you integer solutions to the equation.

Just as Bob1123 commented, compute the discriminant for the equation $$x^2-12 x+(20-3^y)=0$$ and the roots $$x_{1,2}=6\pm\sqrt{3^y+16}$$ So $(3^y+16)$ must be a perfect square.

I only see one which is possible what you already found ($y=2$).

Now, to prove that this is the unique solution is beyond my skills. Fortunately, you have Alex G.'s nice answer.

• Rewriting $$3^y+16=z^2$$ as $$3^y=(z-4)(z+4)$$ makes it clear that the uniqueness of the solution $y=2$ can be proved in the same way as in my answer. Though I expect you were somewhat ironic :D – Vincenzo Oliva Jul 26 '15 at 15:12
• @VincenzoOliva. Perfectly correct ! Be sure I was not ironic at all ! Thanks. Cheers :-) – Claude Leibovici Jul 26 '15 at 15:16
• Who nose... :v Cheers! – Vincenzo Oliva Jul 26 '15 at 15:20
• if you let $z = \sqrt {3^y + 16}$, and square them, $z^2 = 3^y + 4^2$ you can see this is a similar to the smallest possible value for right angle triangle with integer length in Pythagoras Theorem. – wuiyang Jul 26 '15 at 15:36

By the Fundamental Theorem of Arithmetic, $x-2$ and $x-10$ must be powers of $3$, so we may write $$x-2= \pm 3^a$$ and $$x-10 = \pm 3^b.$$ Substracting the latter from the former we get $$8=\pm 3^a\mp3^b \\ 2^3 =3^a(\mp3^{b-a}\pm1)= 3^b (\pm3^{a-b} \mp1),$$ whence, again by FTA, $(a,b)= (0,2),( 2,0)$ and thus $(x,y)= (1,2),(11,2)$ are the only pairs of integer solutions.