login
A194854
Starting from a(1)=1, describe previous terms and then add all the digits.
1
1, 2, 5, 11, 13, 18, 28, 30, 32, 34, 40, 42, 44, 46, 54, 56, 58, 60, 62, 64, 66, 68, 70, 79, 90, 92, 94, 96, 98, 100, 103, 106, 100, 94, 87, 89, 91, 84, 86, 88, 81, 83, 85, 87, 89, 82, 84, 86, 88, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 104, 107, 110, 113
OFFSET
1,2
EXAMPLE
Start with 1. There is one 1: 11 and 1+1=2. The sequence is now 1,2. Therefore one 1 and one 2: 1112 and 1+1+1+2=5. The sequence is now 1,2,5. Again: 111215 and 1+1+1+2+1+5=11. And so on.
MAPLE
sd:=proc(j)
local c, d, h, k;
h:=j; c:=0;
if h>0 then
d:=floor(evalf(log10(h))+1);
for k from 1 to d do c:=c+h-10*trunc(h/10); h:=trunc(h/10); od;
fi;
c;
end:
P:=proc(i)
local a, b, f, n, p, s, v;
v:=array[10]; v[1]:=1; v[10]:=0; print(v[1]);
for n from 2 to 9 do v[n]:=0; od;
for n from 1 by 1 to i do
a:=0;
for p from 1 to 10 do
if sd(v[p])=0 then a:=a+sd(v[p]);
else a:=a+(p mod 10)+sd(v[p]);
fi;
od;
print(a); s:=floor(evalf(log10(a))+1);
for p from 1 to s do
f:=a-10*trunc(a/10); a:=trunc(a/10);
if f=0 then v[10]:=v[10]+1; else v[f]:=v[f]+1; fi;
od;
od;
end:
P(10000);
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paolo P. Lava, Sep 07 2011
STATUS
approved