All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Checking the quantity (Posted on 2023-09-23)

p^a+q^b=r^c

How many distinct solutions of the equation above are there, subject to the following constraints:

p, q, & r distinct primes
a, b, & c distinct positive integers,
each more than one
None of the powers exceeds 1111.

 No Solution Yet Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 Computer solution for smaller numbers | Comment 1 of 8
I found 3 solutions,
but this search was limited to primes up to 2000 and powers from 2 to 30:

32   49    81
2^5 + 7^2 = 3^4

128   4913    5041
2^7 + 17^3 = 71^2

169   343    512
13^2 + 7^3 = 2^9

--------------
from itertools import combinations
def isprime(n):
'''check if integer n is a prime'''
n = abs(int(n))
if n < 2:
return False
if n == 2:
return True
if not n & 1:
return False
for x in range(3, int(n**0.5)+1, 2):
if n % x == 0:
return False
return True

highest_prime = 2000
#highest_power = 1111
highest_power = 20  # for testing
primes = [i for i in range(highest_prime) if isprime(i)]
rcdict = {}
ans = []
for pr in primes:
for po in range(2, highest_power+1):
r2c = pr**po
rcdict[r2c] = [pr,po]
rclist = sorted(rcdict.keys())
for comb in combinations(rclist,2):
if comb[0]+comb[1] in rclist:
p = rcdict[comb[0]][0]
a = rcdict[comb[0]][1]
q = rcdict[comb[1]][0]
b = rcdict[comb[1]][1]
r = rcdict[comb[0]+comb[1]][0]
c = rcdict[comb[0]+comb[1]][1]
if p==q or p==r or q==r:
continue
if a==b or b==c or a==c:
continue
print(' ', comb[0], ' ', comb[1], '  ',  comb[0]+comb[1])
print('{}^{} + {}^{} = {}^{}'.format(p,a,q,b,r,c) )
ans.append([p,a,q,b,r,c])

Edited on September 23, 2023, 5:57 pm
 Posted by Larry on 2023-09-23 17:55:06

 Search: Search body:
Forums (0)