login
A226134
The partial digital sums of n from left to right mod 10 give the digits of a(n).
4
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, 28, 29, 20, 21, 33, 34, 35, 36, 37, 38, 39, 30, 31, 32, 44, 45, 46, 47, 48, 49, 40, 41, 42, 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
OFFSET
0,3
COMMENTS
Inverse permutation to A098488.
Analogous to A006068 for the decimal base.
For any n, the sequence n, a(n), a(a(n)), a(a(a(n))),... is periodic.
The periods encountered between 0 and 10^6 are:
- 1 (n=0),
- 10 (n=10),
- 5 (n=20),
- 2 (n=50),
- 20 (n=100),
- 4 (n=500),
- 40 (n=10000),
- 8 (n=50000),
- 200 (n=100000),
- 25 (n=200000),
- 50 (n=200010),
- 100 (n=200100).
EXAMPLE
1 = 1 mod 10.
1+9 = 0 mod 10.
1+9+5 = 5 mod 10.
1+9+5+4 = 9 mod 10.
Hence, a(1954)=1059.
MATHEMATICA
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 *)
PROG
(PARI) a(n)=my(b); if(n<10, return(n), b=a(n\10); return(10*b + (b+n)%10))
(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
(Haskell)
a226134 = foldl (\v d -> 10*v+d) 0 . scanl1 (\d x -> (x+d) `mod` 10) .
map (read . return) . show :: Int -> Int
-- Reinhard Zumkeller, Jun 03 2013
CROSSREFS
Sequence in context: A033865 A364274 A118764 * A057717 A183222 A063742
KEYWORD
base,easy,nonn
AUTHOR
Paul Tek, May 27 2013
STATUS
approved