Determine all possible pairs (x,y) of
half-integers, with x ≤ y, that satisfy this equation:
[x
2] + [y
2] = 2016
Prove that there are no others.
*** [x] denotes the greatest integer ≤ x.
10 for X=1 to 5000 step 2
20 for Y=X to 5000 step 2
30 T=int(X*X//4)+int(Y*Y//4)
40 if T=2016 then print X//2,Y//2
50 next
60 next
110 for X=-1 to -10000 step -2
120 Term1=int(X*X//4)
130 Term2=2016-Term1
140 Ysq=Term2+1//4
150 Num=Ysq*4
160 Y=int(sqrt(Num)+0.5)
170 if Y*Y=Num then print X//2,Y//2
180 next
finds
x y
29/2 85/2
55/2 71/2
-29/2 85/2
-55/2 71/2
-71/2 55/2
-85/2 29/2
before running out of real answers and crashing with:
Illegal parameter in 160
The program uses variables x and y to represent twice x or y.
|
Posted by Charlie
on 2013-07-31 18:13:43 |