The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A252648 Irregular table of perfect digital invariants for n > 1, i.e., numbers equal to the sum of n-th powers of their digits, read by rows. 13

%I

%S 1,0,1,2,3,4,5,6,7,8,9,0,1,0,1,153,370,371,407,0,1,1634,8208,9474,0,1,

%T 4150,4151,54748,92727,93084,194979,0,1,548834,0,1,1741725,4210818,

%U 9800817,9926315,14459929,0,1,24678050,24678051,88593477,0,1,146511208,472335975,534494836,912985153,0,1,4679307774

%N Irregular table of perfect digital invariants for n > 1, i.e., numbers equal to the sum of n-th powers of their digits, read by rows.

%C The third column is listed in A003321. - _M. F. Hasler_, Feb 16 2015

%C For a number x >= 10^(d-1) with d digits, the sum of n-th powers of these digits cannot exceed d*9^n. Therefore there is only a finite number of possible perfect digital invariants for any n, the largest of which has at most d* digits, where d* = 1+(n*log(9)+log d*)/log(10). - _M. F. Hasler_, Apr 14 2015

%H Don Knuth, <a href="http://www-cs-faculty.stanford.edu/~knuth/perfect_digital_invariants.txt">Table of a(n) for n=0..732</a>

%H Don Knuth, <a href="http://www-cs-faculty.stanford.edu/~knuth/programs/back-pdi.w">CWEB program to generate solutions</a>

%e The table starts:

%e 1; (n = 0; 1 = 1^0.)

%e 0, 1, 2, 3, 4, 5, 6, 7, 8, 9; (n = 1)

%e 0, 1; (n = 2)

%e 0, 1, 153, 370, 371, 407; (n = 3, A046197)

%e 0, 1, 1634, 8208, 9474; (n = 4, A052455)

%e 0, 1, 4150, 4151, 54748, 92727, 93084, 194979; (n = 5, A052464)

%e 0, 1, 548834; (n = 6)

%e 0, 1, 1741725, 4210818, 9800817, 9926315, 14459929; (n = 7, A124068)

%e 0, 1, 24678050, 24678051, 88593477; (n = 8, A124069)

%e 0, 1, 146511208, 472335975, 534494836, 912985153; (n = 9, A226970)

%e The third column corresponds to A003321.

%e The term 153 is member of the row n=3 because 153 = 1^3 + 5^3 + 3^3. - _M. F. Hasler_, Apr 14 2015

%o (PARI) row(n)={m=1;while(m*9^n>=10^m,m++);for(k=1,10^m,sum(i=1,#d=digits(k),d[i]^n)==k && print1(k,", "))}

%o for(n=0,7,print1(row(n),", "))

%o (Python)

%o from itertools import combinations_with_replacement

%o A252648_list = 

%o for m in range(1,21):

%o l, L, dm, xlist, q = 1, 1, [d**m for d in range(10)], , 9**m

%o while l*q >= L:

%o for c in combinations_with_replacement(range(1,10),l):

%o n = sum(dm[d] for d in c)

%o if sorted(int(d) for d in str(n)) == *(len(str(n))-len(c))+list(c):

%o xlist.append(n)

%o l += 1

%o L *= 10

%o A252648_list.extend(sorted(xlist)) # _Chai Wah Wu_, Jan 04 2016

%Y Cf. A003321, A046197, A052455, A052464, A124068, A124069, A226970.

%K nonn,base,tabf

%O 0,4

%A _Derek Orr_, Dec 19 2014