A178354 Numbers m such that d(1)^1 + d(2)^2 + ... + d(p)^p = d(1)^p + d(2)^(p-1) +... + d(p)^1, where d(i), i=1..p, are the digits of m.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 22, 33, 44, 55, 66, 77, 88, 99, 100, 101, 110, 111, 120, 121, 130, 131, 140, 141, 150, 151, 160, 161, 170, 171, 180, 181, 190, 191, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 303, 313, 323, 333, 343, 353, 363, 373, 383, 393, 404, 414, 424, 434, 444, 454
Offset: 1
Examples
14603 is in the sequence because : 1 + 4^2 + 6^3 + 0^4 + 3^5 = 3 + 0^2 + 6^3 + 4^4 + 1^5 = 476.
Links
- Carole Dubois, Table of n, a(n) for n = 1..34794
- Carole Dubois, Scatterplot of a(n) vs Sum of powers in definition.
Programs
-
Maple
with(numtheory):for n from 1 to 50000 do:l:=length(n):n0:=n:s1:=0:s2:=0:for m from 1 to l do:q:=n0:u:=irem(q,10):v:=iquo(q,10):n0:=v :s1:=s1+u^(l-m+1):s2:=s2+u^m:od: if s1=s2 then printf(`%d, `,n):else fi:od:
-
Mathematica
drQ[n_]:=Module[{id=IntegerDigits[n],len},len=Length[id];Total[ id^Range[ len]] == Total[id^Range[len,1,-1]]]; Select[Range[500],drQ] (* Harvey P. Dale, Aug 04 2018 *)
-
PARI
isok(m) = my(d=digits(m), p=#d); sum(k=1, p, d[k]^k) == sum(k=1, p, d[k]^(p-k+1)); \\ Michel Marcus, Mar 22 2021
-
Python
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) == digpow(s[::-1]): alst.append(k) return alst print(aupto(454)) # Michael S. Branicky, Mar 23 2021
Comments