|
|
A178463
|
|
The number of iterations for the map : r -> !d(1)+ !d(2)+...+ !d(r) starting with n, needed to reach 0 or stabilize, where d(i), i=1..r, are the decimal digits of n.
|
|
0
|
|
|
2, 1, 2, 3, 10, 33, 6, 7, 31, 9, 2, 1, 2, 3, 10, 33, 6, 7, 31, 9, 3, 2, 3, 4, 3, 25, 25, 6, 32, 26, 4, 3, 4, 11, 2, 23, 6, 27, 31, 14, 3, 10, 3, 2, 32, 24, 22, 25, 40, 16, 25, 33, 25, 23, 24, 8, 28, 44, 32, 34, 25, 6, 25, 6, 22, 28, 27, 27, 17, 13, 6, 7, 6, 27, 25, 44, 27, 33, 21, 16
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
COMMENTS
|
!k is a subfactorial number (A000166).
a(148349)= 0 because the only number equal to the sum of subfactorials of its digits is :
148349 = !1 + !4 + !8 + !3 + !4 + !9.
|
|
LINKS
|
|
|
EXAMPLE
|
a(0) = 2 because 0 -> 1->; 0 ;
a(1) = 1 because 1 -> 0 ;
a(2) = 2 because 2 -> 1-> 0 ;
a(3) = 3 because 3 -> 2 -> 1-> 0 ;
a(4) = 10 because 4 -> 9 -> 133496 -> 133774 -> 3721 -> 1857 ->
16731->2121->2 ->1->0.
|
|
MAPLE
|
with(numtheory): f:=n->sum(n!*(((-1)^k)*1/k!), k=0..n):for n from 1 to 150 do:it:=1:nn:=n:ind:=0:for iter from 1 to 50 do: l:=length(nn):n0:=nn:s:=0:for m from 1 to l do:q:=n0:u:=irem(q, 10):v:=iquo(q, 10):n0:=v :s:=s+f(u): od: nn:=s:if nn<>0 then it:=it+1:else fi:od:printf(`%d, `, it):od:
|
|
MATHEMATICA
|
g[n_] := Plus @@ Subfactorial /@ IntegerDigits@ n; f[n_] := Length@ Sort@ NestWhileList[ g, n, # != 0 &, 1, 111] - 1; f[0] = 2; Array[f, 80, 0]
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|