A342944 Numbers m such that d(1)^0 + d(2)^1 + ... + d(k)^(k-1) = d(1)! + d(2)! + ... + d(k)!, where d(i), i=1..k, are the digits of m.
1, 11, 12, 111, 121, 133, 202, 1020, 1111, 1211, 1331, 1403, 2021, 2030, 2120, 2220, 2305, 2413, 3012, 3102, 3115, 3202, 3215, 3322, 3335, 4033, 4123, 4223, 4434, 10165, 10201, 10210, 10300, 10533, 11065, 11111, 11200, 12065, 12111, 12200, 13050, 13265, 13311
Offset: 1
Examples
2413 is in this sequence because 2^0 + 4^1 + 1^2 + 3^3 = 2! + 4! + 1! + 3! = 33.
Programs
-
Mathematica
Select[Range@20000,Total[(a=IntegerDigits@#)^Range[0,Length@a-1]]==Total[a!]&] (* Giorgos Kalogeropoulos, Mar 30 2021 *)
-
PARI
is(n) = my(d = digits(n)); sum(i = 1, #d, d[i]!) == sum(i = 1, #d, d[i]^(i-1)) \\ David A. Corneth, Mar 30 2021
-
Python
from math import factorial def digfac(s): return sum(factorial(int(d)) for d in s) def digpow(s): return sum(int(d)**i for i, d in enumerate(s)) def aupto(limit): alst = [] for k in range(1, limit+1): s = str(k) if digpow(s) == digfac(s): alst.append(k) return alst print(aupto(14000)) # Michael S. Branicky, Mar 30 2021