Let N be a positive integer with an even number of decimal digits, say abcd...yz.
For how many N does a^b + c^d + ... + y^z? equal zy...dcba, that is, N with its digits reversed? One example is N=52, since 5^2 = 25.
[If 00 occurs, take its value as 1. Do not include any solutions ending with 00.]
I believe this is the entire solution set:
{10, 52, 64455910}
If ending in 00 were allowed, then every number of the form k * 10^(2k-1) for k= 1, 2, ..., 9 would be a solution: 10, 2000, 300000, 40000000 etc
Given the 00 restiction, here is a proof that no solution longer than 10 digits can exist.
9^9 = 387420489 which is 9 digits, so a 10 digit solution ending in 0 might be possible.
A 10 digit number consisting of all 9s yields 5*9^9 = 1937102445 which is 10 digits: possible.
A 12 digit number consisting of all 9s yields 6*9^9 = 2324522934 which is 10 digits but reverse must be at least 11 digits: impossible.
There can be no solution longer than 10 digits
I noticed that for a 10 digit solution, the 5 couplets would need to include at least one of the following, in order to be at least 9 digits: {79,89,99,98} (although 7^9 is only 8 digits, 5 * 7^9 is 9 digits). This sped up the the search of 10 digit numbers by about a factor of 5 or 6.
----------
ans = []
for d in range(2,11,2):
for n in (range(10**(d-1), 10**d)):
thesum = 0
sn = str(n)
if d == 10:
prs = [sn[:2], sn[2:4], sn[4:6], sn[6:8], sn[8:10]]
if not any(('79'in prs,'89'in prs,'99'in prs,'98'in prs)):
continue
target = int(sn[::-1])
for ind in range(int(d/2)):
thesum += int(sn[2*ind]) ** int(sn[2*ind+1])
if thesum == target:
print(n)
ans.append(n)
|
Posted by Larry
on 2024-05-02 13:12:34 |