OFFSET
1,2
LINKS
Paolo P. Lava, Table of n, a(n) for n = 1..10000
Paolo P. Lava, Plot of the first 10000 terms of the sequence
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