login
The partial digital sums of n from left to right mod 10 give the digits of a(n).
4

%I #18 May 16 2020 01:09:50

%S 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,10,22,23,24,25,26,27,

%T 28,29,20,21,33,34,35,36,37,38,39,30,31,32,44,45,46,47,48,49,40,41,42,

%U 43,55,56,57,58,59,50,51,52,53,54,66,67,68,69,60,61,62,63,64,65,77,78,79,70,71,72,73,74,75,76,88,89,80,81,82,83,84,85,86,87

%N The partial digital sums of n from left to right mod 10 give the digits of a(n).

%C Inverse permutation to A098488.

%C Analogous to A006068 for the decimal base.

%C For any n, the sequence n, a(n), a(a(n)), a(a(a(n))),... is periodic.

%C The periods encountered between 0 and 10^6 are:

%C - 1 (n=0),

%C - 10 (n=10),

%C - 5 (n=20),

%C - 2 (n=50),

%C - 20 (n=100),

%C - 4 (n=500),

%C - 40 (n=10000),

%C - 8 (n=50000),

%C - 200 (n=100000),

%C - 25 (n=200000),

%C - 50 (n=200010),

%C - 100 (n=200100).

%H Paul Tek, <a href="/A226134/b226134.txt">Table of n, a(n) for n = 0..10000</a>

%H Paul Tek, <a href="/A226134/a226134.png">Parity of the decimal digits of n, a(n), a(a(n)), a(a(a(n))),... with n=200!</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%e 1 = 1 mod 10.

%e 1+9 = 0 mod 10.

%e 1+9+5 = 5 mod 10.

%e 1+9+5+4 = 9 mod 10.

%e Hence, a(1954)=1059.

%t Table[With[{idn=IntegerDigits[n]},FromDigits[Table[Mod[Total[Take[idn,i]],10],{i,Length[idn]}]]],{n,0,90}] (* _Harvey P. Dale_, Mar 08 2015 *)

%o (PARI) a(n)=my(b); if(n<10, return(n), b=a(n\10); return(10*b + (b+n)%10))

%o (PARI) a(n) = my(v=digits(n)); for(i=2,#v, v[i]=(v[i]+v[i-1])%10); fromdigits(v); \\ _Kevin Ryde_, May 15 2020

%o (Haskell)

%o a226134 = foldl (\v d -> 10*v+d) 0 . scanl1 (\d x -> (x+d) `mod` 10) .

%o map (read . return) . show :: Int -> Int

%o -- _Reinhard Zumkeller_, Jun 03 2013

%Y Cf. A098488, A006068.

%K base,easy,nonn

%O 0,3

%A _Paul Tek_, May 27 2013