OFFSET
1,1
EXAMPLE
28 -> 2^8 = 256 -> 2^5*6 = 192 -> 1^9*2 = 2.
PROG
def powertrain(n):
p, s = 1, str(n)
if len(s)%2 == 1: s += '1'
for b, e in zip(s[0::2], s[1::2]): p *= int(b)**int(e)
return p
def aupto(limit, target=0):
alst = []
for n in range(1, limit+1):
m, ptm = n, powertrain(n)
while m != ptm: m, ptm = ptm, powertrain(ptm)
if m == target: alst.append(n)
return alst
print(aupto(552, target=2)) # Michael S. Branicky, Feb 21 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Martin Renner, Jul 22 2019
STATUS
approved