(
p=13,
q=31) is the only solution testing primes up to 10,000
primes = [p for p in range(10000) if isprime(p)]
for p in primes:
for q in primes:
if p*(p**2-p-1) == q*(2*q+3):
print('(p={}, q={})'.format(p,q))
note:
Even if you allow non-primes, all integers including zero and negatives, there are not that many solutions (testing up to 10,000):
(p=-1, q=-1)
(p=0, q=0)
(p=1, q=-1)
(p=2, q=-2)
(p=4, q=4)
(p=13, q=31)
(p=35, q=-145)
(p=81, q=-513)
|
Posted by Larry
on 2023-11-17 11:15:19 |