# [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:27:35 CEST 2009

```Et al,

I am supplying the Mathematica coding for the array:

a[1, k_] = k; a[n_, k_] := a[n, k] = a[n - 1, k] + Plus @@
Flatten[Map[IntegerDigits, Table[a[i, k], {i, n - 1}]]]

The easiest way to produce the main diagonal is: Table[a[n, n], {n, 50}]
This produces something which disagrees with the list below by Farideh
Firoozbakht. I get:
{1, 4, 15, 34, 53, 75, 173, 209, 378, 212, 454, 480, 724, 1009, 768, 1225, 1442,
1467, 1880, 1823, 2199, 2522, 3124, 3030, 3382, 3796, 4284, 4972, 4649, 5181,
5018, 5912, 7080, 6758, 7801, 8514, 9190, 9013, 11022, 10285, 10097, 11334,
11918, 13592, 13212, 14297, 16357, 17454, 16807, 17965}

I believe that the error is in her initial definition.

Bob.

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

>
>
>
>  --- Farideh
>
>
> Quoting Farideh Firoozbakht <f.firoozbakht at sci.ui.ac.ir>:
>
>> Quoting Jonathan Post <jvospost3 at gmail.com>:
>>
>>> so the array begins (done by hand, needs checking)
>>>
>>> a(1) = k; a(n) = a(n-1) + sum of all decimal digits so far in the
>>> sequence (row of array)
>>>
>>> ......|.n=1.|.n=2.|.n=3.|.n=4.|.n=5.|.n=6.|.n=7.|
>>> k=1.|....1.|.....2.|.....5.|...13.|...25.|...44...|.71.|
>>> k=2.|....2.|.....4.|.....8.|...16.|...39.|...90...|189.|
>>> k=3.|....3.|.....6.|...21.|...45.|...99.|..216...|441.|
>>>
>>> and main diagonal 1, 4, 21, ...?
>>
>>  The correct values:
>>
>>    ......|.n=1.|.n=2.|.n=3.|.n=4.|.n=5.|.n=6.|.n=7.|
>>   k=1.|....1.|.....2.|.....5.|...13.|...25.|...44...|.71.|
>>   k=2.|....2.|.....4.|....10.|...17.|...32.|...52...|.79.|
>>   k=3.|....3.|.....6.|....15.|...30.|...48.|...78...|123.|
>>   k=4    4       8        20     34     55     86    131
>>   k=5    5      10        16     29     53     85    130
>>   k=6    6      12        21     33     51     75    111
>>   ...
>>
>>  and main diagonal :
>>
>>  1, 4, 15, 34, 53, 75, 173, 209, 378, 419, 544, 597, 967, 1027, 1227,
>>  1315, 1712, 2007, 2285, 2624, 2694, 2909, 4006, 4092, 4354, 4336,
>>  4599, 5818, 5675, 6369, 6215, 7613, 8403, 8225, 9646, 9432, 10207,
>>  11083, 11967, 12355, 12797, 14583, 15158, 16427, 16470, 17303, 18166,
>>  19803, 20119, 19153, ...
>>
>>
>>  --- Farideh
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ----------------------------------------------------------------
>> University of Isfahan (http://www.ui.ac.ir)
>
>
>
>
>
>
>
>
>
> ----------------------------------------------------------------
> University of Isfahan (http://www.ui.ac.ir)
>
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/

```