# Positive integers $(x,y)$ satisfying $x^2-y^2= 12345678$?

I saw this question in one of the previous year Olympiad questions.

Let $$S$$ be the set of all ordered pairs of positive integers $$(x,y)$$ satisfying the condition : $$x^2-y^2= 12345678$$

Then what can be said about the number of elements in set $$S$$ ?

The solution of this question doesn't seem to be correct. Look at it :

Can someone provide me a reasonable approach ?

• Is it $x^2+y^2$ or $x^2-y^2$ ? – Jean Marie Jan 22 at 18:20
• Why does RHS even $\implies x,y$ odd rather than $x,y$ even? – Adam Rubinson Jan 22 at 18:28
• @AdamRubinson If $x,y$ are even, RHS is divisible by $4$ – saulspatz Jan 22 at 18:29
• Ohhhh yeah good point. – Adam Rubinson Jan 22 at 18:30
• @Jean Marie sorry my mistake ;) – A Student 4ever Jan 22 at 18:34

$$x^2-y^2\equiv 12345678\equiv 2$$ modulo $$4$$ which is not possible since squares are $$0$$ or $$1$$ modulo $$4$$. So the answer given is correct.

• (+1) The letter chosen is correct. The reasoning given is not wholly correct. – robjohn Jan 23 at 3:04

$$x$$ and $$y$$ are both even or both odd, since $$x^2-y^2$$ is even.

Suppose they are both even.

$$x=2m;\;y=2n$$

$$4m^2-4n^2=4(m^2-n^2)$$ is a multiple of $$4$$, but $$12345678$$ is not divisible by $$4$$.

$$x,y$$ can't be both even.

Suppose now they are both odd

$$x=2m+1;\;y=2n+1$$

$$(2m+1)^2-(2n+1)^2=4m^2+4m+4n^2+4n=4(m^2+m+n^2+n)$$ is a multiple of $$4$$ and this can't be true so $$x,y$$ can't be both odd.

This means that there are no numbers satisfying the given property.

Hope this can be useful

Edit

Actually the solution given in the image OP posted is not very clear. Why both odd? And why $$x^2-y^2$$ must be a multiple of $$8$$?

This last one is actually true because $$4(m^2+m+n^2+n)=4 (m-n) (m+n+1)$$ as one of the two factors $$m-n$$ or $$m+n+1$$ is even, then the result is divisible by $$8$$

$$x^2 - y^2 = 12345678$$ which is even.

That means that $$x^2, y^2$$ must both be even or both be odd.

If they are both even then $$x,y$$ are both even $$x^2 -y^2$$ would be divisible by $$4$$ which $$12345678$$ is not.

If they are both odd then we have $$x^2 - y^2 = (x-y)(x+y)$$. And both $$x-y$$ and $$x+y$$ are both even, so again $$x^2-y^2$$ is divisible by $$4$$ (actually it is divisible by $$8$$).

.....

I'm not sure why the answer claimed that if $$x^2 - y^2$$ is even that $$x,y$$ should both be odd (was it assuming $$x,y$$ were relatively prime??? I don't know.)

But other than that the explanation is perfectly correct.