-1

Find all positive integers n < 200, such that $n^2$ + $(n + 1)^2$ is a perfect square

I tried the following Let $n^2$ + $(n + 1)^2 = m^2$ where $m$ is a positive integer. Now $$(m+n)(m-n) = (n+1)^2$$ I dont know how to proceed after this. I also tried expanding original equation but that was also of no help.

Frosty
  • 123
  • Write a programme for them. That way, you'll know what to look for. – Shaun Jul 09 '23 at 15:29
  • 1
    You could see $n^2 + (n+1)^2 = m^2$ as a quadratic equation of $n$ and solve it. – fus3r Jul 09 '23 at 15:33
  • 1
    $(2n+1)^2-2m^2=-1,$ so this is a case of the negative Pell equation. – Thomas Andrews Jul 09 '23 at 15:33
  • 1
    You are talking about Pythagorean triples, which have a known parametrization. That said, it's such a small sample that routine search is much easier than anything else. – lulu Jul 09 '23 at 15:34
  • Specifically, you get $$4n+2=(1+\sqrt 2)^k+(1-\sqrt2)^k$$ when $k$ is odd. Since $-1<1-\sqrt2<0,$ this can be written as $$4n+2=\left\lfloor (1+\sqrt2)^k\right\rfloor$$ for $k$ odd. – Thomas Andrews Jul 09 '23 at 15:38
  • or $n_{j+2} = 6 n_{j+1} - n_j +2 $ with $n_0 = 0, n_1 = 3, n_2 = 20,$ – Will Jagy Jul 09 '23 at 15:42
  • $$(3,4,5)\ (20,21,29)\ (119,120,169)\ (696,697,985)\ (4059,4060,5741)\ (23660,23661,33461)\ (137903,137904,195025)\ (803760,803761,1136689)\ (4684659,4684660,6625109)\ (27304196,27304197,38613965)\ (159140519,159140520,225058681)\ (927538920,927538921,1311738121)\ (5406093003,5406093004,7645370045)\ (31509019100,31509019101,44560482149)\ (183648021599,183648021600,259717522849)\ (1070379110496,1070379110497,1513744654945)\ (6238626641379,6238626641380,8822750406821)\ (36361380737780,36361380737781,51422757785981)$$ – Dietrich Burde Jul 09 '23 at 15:50
  • The easiest (and prettiest) way it to use the Pythagorean triple tree as here. – Bill Dubuque Jul 09 '23 at 18:39

1 Answers1

1

Hint : Note that $X^2+Y^2=Z^2$ has solutions which are Pythagorean triples and these solutions are precisely of the form $(d(u^2-v^2),d(2uv), d(u^2+v^2))$, where $u,v$ are prime to each other (possibly interchanging the X and Y coordinates). If you want only positive integer solutions you can further assume that $u>v$.

For your problem, it follows from the equality $n^2+(n+1)^2=m^2$ that $n,n+1,m$ are pairwise coprime. That means you can find $u,v$ with $u>v$ and $\gcd(u,v)=1$ such that $n=u^2-v^2,~n+1=2uv$ and $m=u^2+v^2$ ($d$ is of course 1 here).