All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 1997 Crossed Difference Product Poser (Posted on 2023-05-22)
Find all pairs (x,y) of positive integers that satisfy this equation:

•   x2+y2 = 1997(x-y)

Provide valid reasoning as to why there are no further solutions.

 See The Solution Submitted by K Sengupta Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Solution | Comment 1 of 2
consider limits on x and y.
x > y since LHS must be positive
x=y=0 solves the equation
x=1997, y=0 solves the equation

Further, if you collect like variables and complete the squares the equation can be converted to:
(x - 1997/2)^2 + (y + 1997/2)^2 = 2*(1997/2)^2
Which is a circle centered at (998.5, -998.5) with radius √2*998.5 (about 1412.09)
So y=f(x) is positive only if 0 < x < 1997

If you solve for y, treating x as a constant:
y^2 + 1997*y + x^2 - 1997x = 0
y = (-1997 + sqrt(1997^2 - 4x^2 + 4*1997*x) )/2

So do a search on integer values of x from 1 to 1996 and see if the corresponding y values are integers.

Other than the rejected solutions of (0,0) and (1997,0), the following code only finds two solutions:
(170, 145) and (1827, 145)

In retrospect, if you could look at the discriminant, (1997^2 - 4x^2 + 4*1997*x), and find values for x that gave a perfect square which is also odd, then you would have a solution.

----------

def f(x):
return (-1997 + (1997**2 - 4*x**2 + 4*1997*x)**.5)/2
epsilon = .000001
for x in range(0,1998):
if abs(f(x) - round(f(x))) < epsilon:
print(x, f(x), x**2 + f(x)**2, 1997*(x-f(x)))

for x in range(0,1998):
if f(x)%1 == 0:
print(x, f(x), x**2 + f(x)**2, 1997*(x-f(x)))
 Posted by Larry on 2023-05-22 07:30:01

 Search: Search body:
Forums (0)