# [seqfan] Re: Digital root

Robert G. Wilson v rgwv at rgwv.com
Tue Jan 22 05:50:38 CET 2013

```Seq.Fans,

Using the Mathematica coding:
f[n_] := f[n] = Block[{s = PadLeft[{1}, n], c = 1}, s = t = Nest[g, s, n];
While[t = g[t]; s != t, c++]; c];
g[lst_List] := Rest at Append[lst, 1 + Mod[-1 + Plus @@ lst, 9]];
Do[ Print[{n, f[n] // Timing}], {n, 100}]

I found the following:

{1, 24, 39, 78, 312, 2184, 1092, 240, 273, 26232, 11553, 9840, 177144,
14348904, 21523359, 10315734, 48417720, 16120104, 15706236, ..., }

Theorem: All a(n) <= 9^n.

Bob.

-----Original Message-----
From: SeqFan [mailto:seqfan-bounces at list.seqfan.eu] On Behalf Of Paolo Lava
Sent: Monday, January 21, 2013 3:35 AM
To: seqfan at list.seqfan.eu
Subject: [seqfan] Re: Digital root

Other entries are:  d=25: 2184, d=26: 2271, d=79: 19680, d=80: 19929.

2013/1/18 Paolo Lava <paoloplava at gmail.com>

> Hello Seq-Fans,
>
> I was thinking about the period of a string of digits created by
> taking, at any step, the digital root of the sum of the previous "d"
> digits, for
> d>=1.
>
>
>
> I start from a configuration of "d" zeros followed by one "1".
>
>
>
> For d=1 I start from 0,1 and I obtain
> 0,1,1,2,3,5,8,4,3,7,1,8,9,8,8,7,6,4,1,5,6,2,8,1,9,1,1, 2, 3, etc.
>
> The period is clearly  equal to 24:
> [1,1,2,3,5,8,4,3,7,1,8,9,8,8,7,6,4,1,5,6,2,8,1,9] .
>
> For d=2 the period is 39:
>
[1,1,2,4,7,4,6,8,9,5,4,9,9,4,4,8,7,1,7,6,5,9,2,7,9,9,7,7,5,1,4,1,6,2,9,8,1,9
,9].
>
>
>
> For d from 1 to 12 I have found:
>
>
>
> d
>
> period
>
> 1
>
> 24
>
> 2
>
> 39
>
> 3
>
> 78
>
> 4
>
> 312
>
> 5
>
> 2184
>
> 6
>
> 1092
>
> 7
>
> 240
>
> 8
>
> 273
>
> 9
>
> 26232
>
> 10
>
> 11553
>
> 11
>
> 9840
>
> 12
>
> 177144
>
>
>
> But from d=13 on?
>
>
>
> Here the Maple program I used. I'm looking for the first occurence of "d"
> 9s in a row preceded (or followed) by 1.
>
>
>
> Axxxxxx:=proc(q,i)
>
> local d,k,n,v;
>
> v:=array(1..q);
>
> for d from 1 to i do
>
>   for n from 1 to d do v[n]:=0; od; v[d+1]:=1;
>
>   for n from d+2 to q do
>
>
>      if add(v[k],k=n-d+1..n)=9*d and v[n-d]=1 then lprint(d,n-d);
> break; fi;
>
> od; od; end:
>
> Axxxxxx(5000000,20);
>
>
> Paolo
>
>

_______________________________________________

Seqfan Mailing list - http://list.seqfan.eu/

```