A342945 Numbers m such that d(1)^1 + d(2)^2 + ... + d(p)^k = d(1)! + d(2)! + ... + d(k)!, where d(i), i=1..k, are the digits of m.
1, 2, 11, 21, 33, 111, 211, 331, 403, 1065, 1111, 1200, 2065, 2111, 2200, 3050, 3265, 3311, 4031, 4122, 4130, 4543, 5143, 10651, 11111, 11650, 12001, 12010, 12100, 13000, 15330, 20651, 21111, 21650, 22001, 22010, 22100, 23000, 25330, 30200, 30501, 30510, 31500
Offset: 1
Examples
3265 is in the sequence because 3^1 + 2^2 + 6^3 + 5^4 = 3! + 2! + 6! + 5! = 848.
Programs
-
Mathematica
Select[Range@40000,Total[(a=IntegerDigits@#)^Range@Length@a]==Total[a!]&] (* Giorgos Kalogeropoulos, 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, start=1)) 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(32000)) # Michael S. Branicky, Mar 30 2021