Solve in $\mathbb{N}$:$$m^2+n^2=1997(m-n)$$ I try with quadratic equation or with factorising, but I have no idea what to do after that.
Solve in non-negative integers: $m^2+n^2=1997 (m-n)$
316 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 3 best solutions below
On
hint: i have found the equation $$(2m-1997)^2+(2n+1997)^2=2\cdot 1997^2$$ I have found this here $$(m=170\land n=145)\lor (m=1827\land n=145)$$
On
Using $x=m$ and $y = n$ we get $$ x^2 + y^2 -1997x + 1997 y = 0 $$ and this is the equation of a conic section $$ A x^2 + B x y + C y^2 + D x + E y + F = 0 $$ with $A = 1$, $B=0$, $C=1$, $D=-1997$, $E=1997$, $F=0$ and discriminant $$ B - 4AC = -4 < 0 $$ which is an ellipse and $B = 0$ and $A = C$ so it is a circle. So we try to bring it to standard form $$ (x - x_0)^2 + (y - y_0)^2 = r^2 $$ which leads to $$ (x - 1997/2)^2 + (y + 1997/2)^2 = 2 (1997/2)^2 = (1997/\sqrt{2})^2 $$ This is a circle $C$ of radius $1997/\sqrt{2}=1412.09$ around $(1997/2,-1997/2)=(998.5, -998.5)$.
We are interested in $C \cap \mathbb{Z}^2$.
At this point I am happy with that $C$ fits nicely into the box $[-414, 2411] \times [-2411,414]$ and let my girl Ruby check the $7,986,276$ cases.
v1: cx = 998.5, cy = -998.5, r = 1412.0922420295353
xmin = -414, xmax = 2411
ymin = -2411, ymax = 414
1: (x,y) = (170, -2142)
2: (x,y) = (1827, -2142)
3: (x,y) = (0, -1997)
4: (x,y) = (1997, -1997)
5: (x,y) = (-145, -1827)
6: (x,y) = (2142, -1827)
7: (x,y) = (-145, -170)
8: (x,y) = (2142, -170)
9: (x,y) = (0, 0)
10: (x,y) = (1997, 0)
11: (x,y) = (170, 145)
12: (x,y) = (1827, 145)
Then I felt guilty for being too lazy and wrote a second version which just walks the 2,826 cases on the $x$-axis and uses $y(x)$ to test for integer solutions.
v2: cx = 998.5, cy = -998.5, r = 1412.0922420295353
xmin = -414, xmax = 2411
1: (x,y) = (-145, -1827) [true] and (-145,-170) [true]
2: (x,y) = (0, -1997) [true] and (0,0) [true]
3: (x,y) = (170, -2142) [true] and (170,145) [true]
4: (x,y) = (1827, -2142) [true] and (1827,145) [true]
5: (x,y) = (1997, -1997) [true] and (1997,0) [true]
6: (x,y) = (2142, -1827) [true] and (2142,-170) [true]
=> true
Source code here.
Dang, I just realized $\mathbb{N}^2$ was wanted. This reduces the search space a bit. So assuming $\mathbb{N}$ starts with $1$, we keep:
1: (x,y) = (170, 145)
2: (x,y) = (1827, 145)
HINT: $$ m^2+n^2=1997(m-n)\iff 4m^2+4n^2=4\cdot1997(m-n)\iff 4m^2-4\cdot1997m+1997^2+4n^2+4\cdot 1997n+1997^2=2\cdot1997^2\iff(2m-1997)^2+(2n+1997)^2=2\cdot1997^2\iff\left((2m-1997)+(2n+1997)\right)^2+\left((2m-1997)-(2n+1997)\right)^2=4\cdot1997^2\iff(m+n)^2+(m-n-1997)^2=1997^2 $$ Now you have a pythagorean triplet.