%I #30 Sep 16 2022 04:05:00
%S 1,2,3,4,5,6,7,8,9,24,332,1676,121374,4975929,134116265,1086588775,
%T 3492159897,8652650287,8652650482
%N Positive integers that can be expressed as the sum of powers of their digits (from right to left) with consecutive natural exponents.
%C Any number > 9 consisting of just one digit (A014181) can't be in the list. (Provable using the Carmichael function.)
%e 24 = 4^2 + 2^3 is a term.
%e 332 = 2^3 + 3^4 + 3^5 is another term.
%o (Python)
%o liste = []
%o for ex in range(0, 20):
%o for t in range(1, 10000):
%o n = t
%o pot = ex
%o ergebnis = 0
%o while n > 0:
%o pot = pot + 1
%o rest = n % 10
%o n = (n - rest) // 10
%o zw = 1
%o for i in range(pot):
%o zw = zw * rest
%o ergebnis = ergebnis + zw
%o if (int(ergebnis) == t) and (t not in liste):
%o liste.append(t)
%o liste.sort()
%o print(liste)
%o (Python)
%o def powsum(digits, startexp):
%o return sum(digits[i]**(startexp+i) for i in range(len(digits)))
%o def ok(n):
%o if n < 10: return True
%o s = str(n)
%o if set(s) <= {'0', '1'}: return False
%o digits, startexp = list(map(int, s))[::-1], 1
%o while powsum(digits, startexp) < n: startexp += 1
%o return n == powsum(digits, startexp)
%o print(list(filter(ok, range(2*10**5)))) # _Michael S. Branicky_, Aug 29 2021
%Y Cf. A023052, A032799, A014181.
%K nonn,base,more
%O 1,2
%A _Reiner Moewald_, Aug 21 2021
%E a(15)-a(19) from _Michael S. Branicky_, Aug 31 2021
|