# [seqfan] Re: a(n) = a(n-1) + [sum of all digits present so far]

Robert G. Wilson, v rgwv at rgwv.com
Mon Oct 5 17:06:04 CEST 2009

```Et Al,

I agree with the terms but I simplified the Mathematica coding.
a[1] = 1; a[n_] := a[n] = a[n - 1] + Plus @@ Flatten[ Map[ IntegerDigits,
Array[a, n - 1]]]; Array[a, 100]

Bob.

----- Original Message -----
From: "Farideh Firoozbakht" <f.firoozbakht at sci.ui.ac.ir>
To: "Eric Angelini" <Eric.Angelini at kntv.be>; <mymontain at yahoo.com>
Cc: "Sequence Fanatics Discussion list" <seqfan at list.seqfan.eu>
Sent: Thursday, October 01, 2009 2:32 PM
Subject: [seqfan] Re: a(n) = a(n-1) + [sum of all digits present so far]

>
>  Hello Eric,
>
>  > 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]
>
>  According to the definition of a(n) we have the following recursion
>  formula for a(n):
>
>  a(1)=1,a(2)=2; a(n+1)=2a(n)-a(n-1)+sod(a(n))
>
>  The correct value of a(9) is 148 , you wrote 113.
>
>  a(9)=106+1+2+5+(1+3)+(2+5)+(4+4)+(7+1)+(1+0+6)=148
>
>  or a(9)=2a(8)-a(7)+sod(a(8))=2*106-71+(1+0+6)=148
>
>  The first 100 terms of this sequence:
>
>  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,
>  15998, 16780, 17584, 18413, 19259, 20131, 21010, 21893, 22799, 23734,
>  24688, 25670, 26672, 27697, 28753, 29834, 30941, 32065, 33205, 34358,
>  35534, 36730, 37945, 39188, 40460, 41746, 43054, 44378, 45728, 47104,
>  48496, 49919, 51374, 52849, 54352, 55874, 57425, 58999, 60613, 62243,
>  63890, 65563, 67261, 68981, 70733, 72505, 74296, 76115, 77954
>
>
>  The Mathematica coding for this sequence:
>
>  a[1]=1;a[2]=2;a[n_]:=a[n]=2*a[n-1]-a[n-2]+Apply[Plus,IntegerDigits[a[
>  n-1]]];Table[a[n],{n,100}]
>
>
>  Best regards,
>  Farideh
>
>
>
> Quoting Jonathan Post <jvospost3 at gmail.com>:
>
>> It's an infinite array, indexed by the initial value(s).  I suggest
>> showing the array explicitly (at least a 2-D slice) and the main
>> diagonal as a derived sequence.
>>
>> -- Prof. Jonathan Vos Post
>>
>> On Thu, Oct 1, 2009 at 9:23 AM, Eric Angelini <Eric.Angelini at kntv.be> wrote:
>>>
>>> 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)
>>>
>>> Best,
>>> É.
>>>
>>>>>
>>> _______________________________________________
>>>
>>> Seqfan Mailing list - http://list.seqfan.eu/
>>>
>
>
>
>
>
>
>
>
> ----------------------------------------------------------------
> University of Isfahan (http://www.ui.ac.ir)
>
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>

```

More information about the SeqFan mailing list