# Solving the Diophantine Equation $x^2 - y! = 2001$ and $x^2 - y! = 2016$

I had recently faced a problem:

Solve the Diophantine Equation $x^2 - y! = 2001$.

Solving it was quite easy. You show how $\forall y \ge 6$, $9|y!$ and since $3$ divides the RHS, it must divide the LHS and if $3|x^2 \implies 9|x^2$ and so the LHS is divisible by $9$ and the RHS is not. Contradiction. Hence, the only solution is $(45, 4)$.

That made me wonder, how we can solve the Diophantine Equation $x^2 - y! = 2016$. We cannot apply the same logic here. $2016$ is a multiple of $9$ and it is clear that $3|x$ and $9 \nmid x$. How do I proceed from here?

Since $2016= 2^5 \cdot 3^2 \cdot 7$, we can use the same argument with $2$ or $7$ instead of $3$.

With $2$ we have:

If $y \ge 8$, then $2^5 \mid y!$ and so $2^5 \mid x^2$. This implies that $2^3 \mid x$ and, since $2^6 \mid y!$, we'd have $2^6 \mid 2016$, which is false.

Therefore, we only have to test $y \le 7$. The only solution is $x=84, y=7$.

With $7$ we have:

If $y \ge 14$, then $7^2 \mid y!$ and so $7^2 \mid x^2$. This implies that $7^2 \mid x$ and we'd have $7^2 \mid 2016$, which is false.

Therefore, we only have to test $y \le 13$. The only solution is $x=84, y=7$.

With $3$, the argument is similar to the one for $2$: If $y \ge 9$, then $3^4 \mid y!$.

• Oh! So we'll have to handcheck for solutions till $y > 14$. Thanks. – TheRandomGuy Apr 20 '16 at 11:55
• $2$ also works. – lhf Apr 20 '16 at 11:58
• No, it doesn't. Does it? $4|2016$. – TheRandomGuy Apr 20 '16 at 12:00
• $2016=63\times 32$ – Quang Hoang Apr 20 '16 at 12:02
• @QuangHoang Nope. $2016 \neq 61 \times 32$. – TheRandomGuy Apr 20 '16 at 12:03