login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(0) = 0; thereafter a(n) is the number of times the last digit of a(n-1) has occurred as last digit in all terms prior to a(n-1).
2

%I #36 Aug 10 2023 07:14:34

%S 0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,11,1,2,1,3,1,4,1,5,1,6,1,

%T 7,1,8,1,9,1,10,12,2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,13,3,4,3,5,3,6,3,

%U 7,3,8,3,9,3,10,14,4,5,4,6,4,7,4,8,4,9,4,10

%N a(0) = 0; thereafter a(n) is the number of times the last digit of a(n-1) has occurred as last digit in all terms prior to a(n-1).

%C If d is the last digit of a(n-1), and d has occurred as last digit of a(j), 0 <= j < n-1, a total of k times, then a(n) = k (compare with A248034).

%H Michael De Vlieger, <a href="/A364788/b364788.txt">Table of n, a(n) for n = 0..10000</a>

%H Michael De Vlieger, <a href="/A364788/a364788.png">Scatterplot of a(n)</a>, n = 0..1024, with a color function showing r = a(n-1) mod 10 in black if r = 0, red if r = 1, ..., magenta if r = 9.

%e a(1) = 0 because a(0) = 0 has been repeated 0 times. a(2) = 1 because a(1) = 0 has been repeated once.

%e a(22) = 11 has last digit 1, and there has been only one occurrence of a prior term having 1 as last digit (a(2) = 1), therefore a(23) = 1.

%e a(53) = 2 (last digit is 2) and there are 9 prior terms with last digit = 2 (8 terms = 2, and a(40) = 12). Therefore a(54) = 9.

%t nn = 120; a[0] = j = 0; c[_] := 0; Do[(a[n] = c[#]; c[#]++) &[Mod[j, 10]]; j = a[n], {n, nn}]; Array[a, nn, 0] (* _Michael De Vlieger_, Aug 08 2023 *)

%Y Cf. A248034.

%K nonn,base

%O 0,5

%A _David James Sycamore_, Aug 07 2023

%E More terms from _Michael De Vlieger_, Aug 08 2023