login
Least k such that k^n is the sum of two distinct proper prime powers (A246547), or 0 if no such k exists.
0

%I #28 Dec 05 2021 10:32:12

%S 12,5,5,3,62

%N Least k such that k^n is the sum of two distinct proper prime powers (A246547), or 0 if no such k exists.

%C Corresponding values of k^n are 12, 25, 125, 81, 916132832, ...

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Beal%27s_conjecture">Beal's conjecture</a>

%F a(p) <= 2 * (2^p - 1) where p is in A000043 since (2^p - 1)^p + (2^p - 1)^(p + 1) = (2 * (2^p - 1))^p.

%e a(1) = 12 because 12 = 2^2 + 2^3.

%e a(2) = 5 because 5^2 = 2^4 + 3^2.

%e a(3) = 5 because 5^3 = 2^2 + 11^2.

%e a(4) = 3 because 3^4 = 2^5 + 7^2.

%e a(5) = 62 because 62^5 = 31^5 + 31^6.

%e a(9) = 2 because 2^9 = 7^3 + 13^2.

%o (Python)

%o from sympy import nextprime, perfect_power

%o def ppupto(limit): # distinct proper prime powers <= limit

%o p = 2; p2 = pk = p*p; pklist = []

%o while p2 <= limit:

%o while pk <= limit: pklist.append(pk); pk *= p

%o p = nextprime(p); p2 = pk = p*p

%o return sorted(pklist)

%o def sum_of_pp(n):

%o pp = ppupto(n); ppset = set(pp)

%o for p in pp:

%o if p > n//2: break

%o if n - p in ppset and n - p != p: return True

%o return False

%o def a(n):

%o k = 2

%o while not sum_of_pp(k**n): k += 1

%o return k

%o print([a(n) for n in range(1, 6)]) # _Michael S. Branicky_, Dec 05 2021

%Y Cf. A001597, A225102, A246547, A282550.

%K nonn,more

%O 1,1

%A _Altug Alkan_, Feb 20 2017