OFFSET
1,2
COMMENTS
If n >= 5, then 9 divides a(n); see comment in A004152. - Bernard Schott, Jun 27 2019
LINKS
Robert Israel, Table of n, a(n) for n = 1..5000
FORMULA
a(n) = Sum_digits(n!+a(n-1)).
EXAMPLE
a(4) = Sum_digits(4!+9) = 6.
MAPLE
P:=proc(n) local a, i, k, w; a:=0; for i from 1 by 1 to n do w:=0; k:=a+i!; while k>0 do w:=w+k-(trunc(k/10)*10); k:=trunc(k/10); od; a:=w; print(a); od; end: P(100);
# alternative:
sd:= n-> convert(convert(n, base, 10), `+`):
A[1]:= 1:
for n from 2 to 100 do A[n]:= sd(n!+A[n-1]) od:
seq(A[i], i=1..100); # Robert Israel, Jun 26 2019
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, Jul 31 2007
EXTENSIONS
Offset corrected by Robert Israel, Jun 26 2019
STATUS
approved