Let's try to find the solutions of Diophantine equation n=(x+y+z)(1/x+1/y+1/z)
where -100 ≤ n ≤ 100.
Assume 1 ≤ |x| ≤ |y| ≤ |z|.
When d=gcd(x,y,z)>1, let x=dx', y=dy', z=dz', then,
(x+y+z)(1/x+1/y+1/z)
= (dx'+dy'+dz')(1/dx'+1/dy'+1/dz')
= (x'+y'+z')(1/x'+1/y'+1/z')
so, we can assume gcd(x,y,z)=1.
And let l=lcm(x,y,z), x'=l/x, y'=l/y, z'=l/z, then,
(x+y+z)(1/x+1/y+1/z)
= (lx'+ly'+lz')(1/lx'+1/ly'+1/lz')
= (x'+y'+z')(1/x'+1/y'+1/z')
so, (x',y',z') is also the solution of above equation. This is called as "dual".
If we consider the case d= -1, we should search the following four cases,
( x, y, z)
(-x, y, z)
( x,-y, z)
( x, y,-z)
10 ' xyz.ub 20 M=1000 30 for X=1 to M 40 for Y=X to M:D=gcd(X,Y) 50 for Z=Y to M:D=gcd(D,Z):if D>1 then 110 60 if and{X=Y,Y=Z} then 110 70 R=fnSub(X,Y,Z) 80 R=fnSub(-X,Y,Z) 90 R=fnSub(X,-Y,Z) 100 R=fnSub(X,Y,-Z) 110 next Z 120 next Y 130 next X 140 end 150 fnSub(X,Y,Z) 160 local N 170 N=(X+Y+Z)*(1//X+1//Y+1//Z) 180 if or{N=0,N=1} then 220 190 if den(N)>1 then 220 200 if abs(N)>100 then 220 210 print N;":";X;",";Y;",";Z 220 return(0)
Start from the range 1 ≤ |x| ≤ |y| ≤ |z| ≤ 1000.
Computation results are next page.
The order of this program is O(n3),
so we should find out the other methods for further computation.
previous | index | next |
---|