# Find all natural numbers $n$ such that $21n^2-20$ is a perfect square.

Find all natural numbers $n$ such that $21n^2-20$ is a perfect square.

I have got the following solutions via programming:

$n=1,2,3,9,14,43,67$ but how can I find these manually? How can I guarantee there are no more solutions?

• Look at this oeis.org/… Commented May 5, 2016 at 11:46
• but is the manual method given?
– user321656
Commented May 5, 2016 at 11:48
• Did you read the linked site? Commented May 5, 2016 at 11:49
• No, but maybe by twisting your equations, you might find theirs. Commented May 5, 2016 at 11:49
• are talking about the recurrence $a_n=5a_{n-2}+a_{n-4}$?
– user321656
Commented May 5, 2016 at 11:53

Now that I see we can drop the discriminant, this is better, and very similar to what Dietrich wrote:

IF $$x^2 + xy - 5 y^2 = -5,$$ then $$4 x^2 + 4xy - 20 y^2 = -20,$$ $$(2x+y)^2 - 21 y^2 = -20.$$ Notice that this gives everything, because if $u^2 - 21 v^2 = -20,$ then $u \equiv v \pmod 2.$

So, to get fewer orbits with the nicer recursion: we get $$y_{k+2} = 5 y_{k+1} - y_k$$ in two threads $$1, 3, 14, 67, 321, 1538, 7369,...$$ $$2, 9, 43, 206, 987, 4729, 22658,...$$ A really careful proof of this is a Conway Topograph, which is easy enough for this problem that I will probably draw it and post it here.

jagy@phobeusjunior:~$./Pell_Target_Fundamental_A 2 5 1 3 5^2 - 21 1^2 = 4 1 x^2 + 1 x y -5 y^2 = -5 Thu May 5 14:14:32 PDT 2016 x: 0 y: 1 ratio: 0 seed x: 3 y: 2 ratio: 1.5 seed x: 5 y: 3 ratio: 1.666666666666667 seed x: 16 y: 9 ratio: 1.777777777777778 x: 25 y: 14 ratio: 1.785714285714286 x: 77 y: 43 ratio: 1.790697674418605 x: 120 y: 67 ratio: 1.791044776119403 x: 369 y: 206 ratio: 1.79126213592233 x: 575 y: 321 ratio: 1.791277258566978 x: 1768 y: 987 ratio: 1.79128672745694 x: 2755 y: 1538 ratio: 1.791287386215865 x: 8471 y: 4729 ratio: 1.79128779868894 x: 13200 y: 7369 ratio: 1.791287827384991 x: 40587 y: 22658 ratio: 1.791287845352635 x: 63245 y: 35307 ratio: 1.791287846602656 x: 194464 y: 108561 ratio: 1.791287847385341 x: 303025 y: 169166 ratio: 1.791287847439793 x: 931733 y: 520147 ratio: 1.791287847473887 x: 1451880 y: 810523 ratio: 1.791287847476259 x: 4464201 y: 2492174 ratio: 1.791287847477744 x: 6956375 y: 3883449 ratio: 1.791287847477848 Thu May 5 14:14:52 PDT 2016 2 5 1 3 Inverse of given automorphism of quadratic form: 3 -5 -1 2 jagy@phobeusjunior:~$


Note that $$x^2−5xy+y^2+5=0$$ is equivalent to $$21x^2-20=(2y-5x)^2.$$ Hence all solutions of the first equation are also solutions of $21n^2-20=m^2$. This explains that the solutions given at OEIS (see the above comment) are also solutions here.

In general, it is well known how to solve the quadratic equations $ax^2+bxy+cy^2=k$ over the integers. In particular, we can solve the generalised Pell's equation $$21x^2-y^2=20.$$

From theory of Pell equation $$21\Bigl(\frac{(55+12\sqrt{21})^n(1+\sqrt{21})-(55-12\sqrt{21})^n(1-\sqrt{21})}{2\sqrt{21}}\Bigr)^2-20=\Bigl(\frac{(55+12\sqrt{21})^n(1+\sqrt{21})+(55-12\sqrt{21})^n(1-\sqrt{21})}{2}\Bigr)^2.$$

• Could you collaborate on how the equation written above follows from theory of Pell equations? Commented May 5, 2016 at 20:43
• for example, math.stanford.edu/~conrad/154Page/handouts/genpell.pdf. If this is not enough, i will write in details. Commented May 5, 2016 at 21:37