Determine all possible integer pairs (p,q) such that p+q²+s³=pqs, where s=gcd(p,q) and gcd denotes the
greatest common divisor.
(In reply to
if s = 1 (one more solution!) by Steve Herman)
In addition to (-1,0), there's also (-1,-1) where s=1 also, as -1+1+1 = (-1)(-1)(1).
10 for Tot=0 to 1000000
20 for P=0 to Tot
30 Q=Tot-P
40 S=gcd(P,Q)
50 if P+Q*Q+S*S*S=P*Q*S then print P;Q
51 if -P+Q*Q+S*S*S=-P*Q*S then print -P;Q
52 if P+Q*Q+S*S*S=-P*Q*S then print P;-Q
53 if -P+Q*Q+S*S*S=P*Q*S then print -P;-Q
60 next
70 next
shows
0 0
0 0
0 0
0 0
-1 0
-1 0
-1 -1
4 2
5 2
5 3
4 6
but the (0,0) lines are extraneous, as gcd(0,0) is really undefined, but the programming language returns a zero.
Also, as before, the totals were not allowed to get up to 1,000,000, so the upper limit of testing was not tested that high.
Edited on June 22, 2007, 9:37 am
|
Posted by Charlie
on 2007-06-22 09:32:49 |