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.
For positive p and q, where p+q is under 21,000, only
(4, 2)
(5, 2)
(5, 3)
(4, 6)
work.
10 for tot = 3 to 1000000
20 for p=1 to tot1
30 q=totp
40 s=gcd(p,q)
50 if p+q*q+s*s*s = p*q*s then print p;q
60 next
70 next

Posted by Charlie
on 20070621 09:49:24 