%I #21 Oct 01 2024 12:19:46
%S 0,1,4,27,256,3125,46656,823543,16777216,387420489,1,2,5,28,257,3126,
%T 46657,823544,16777217,387420490,4,5,8,31,260,3129,46660,823547,
%U 16777220,387420493,27,28,31,54,283,3152,46683,823570,16777243,387420516,256,257,260
%N If decimal expansion of n is ab...d, a(n) = a^a + b^b + ... + d^d (ignoring any 0's).
%H Harvey P. Dale, <a href="/A045512/b045512.txt">Table of n, a(n) for n = 0..1000</a>
%p a:= n-> add(`if`(i=0, 0, i^i), i=convert(n,base,10)):
%p seq(a(n), n=0..42); # _Alois P. Heinz_, Apr 29 2022
%t p[n_]:=Module[{idn=Select[IntegerDigits[n],#>0&]},Total[idn^idn]]; Array[p, 40,0] (* _Harvey P. Dale_, Dec 13 2012 *)
%o (PARI) apply( {A045512(n)=vecsum([d^d|d<-digits(n),d])}, [0..44]) \\ _M. F. Hasler_, Oct 01 2024
%Y Cf. A045503.
%Y See A046253 for fixed points.
%K nonn,base
%O 0,3
%A _N. J. A. Sloane_, _Jeff Burch_
%E Checked by Neven Juric (neven.juric(AT)apis-it.hr), Feb 04 2008