[seqfan] Re: a(n) = a(n-1) + [sum of all digits present so far]
Alois Heinz
heinz at hs-heilbronn.de
Thu Oct 1 20:22:19 CEST 2009
Eric Angelini schrieb:
> Hello SeqFans,
> this seems not to be in the OEIS (else I need new glasses):
>
> S = 1, 2, 5, 13, 25, 44, 71, 106, 113, ...
>
> a(1) = 1
> a(n) = a(n-1) + [sum of all digits present so far in S]
>
> (thus 25 = 13 + 1 + 2 + 5 + 1 + 3)
so you mean sum of decimal digits ...
1, 2, 5, 13, 25, 44, 71, 106, 148, 203, 263, 334, 415,
506, 608, 724, 853, 998, 1169, 1357, 1561, 1778, 2018,
2269, 2539, 2828, 3137, 3460, 3796, 4157, 4535, 4930,
5341, 5765, 6212, 6670, 7147, 7643, 8159, 8698, 9268,
9863, 10484, 11122, 11767, 12434, 13115, 13807, 14518,
15248
b:= proc(n) option remember; local m;
m:= a(n);
`if` (n=1, 0, b(n-1));
while m>0 do
%+ irem (m, 10, 'm')
od;
%
end;
a:= proc(n) option remember;
`if` (n=1, 1, a(n-1) +b(n-1))
end;
seq (a(n), n=1..50);
Alois
More information about the SeqFan
mailing list