This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A364788 #40 Mar 24 2025 11:40:04 %S A364788 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 A364788 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 A364788 7,3,8,3,9,3,10,14,4,5,4,6,4,7,4,8,4,9,4,10 %N A364788 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 A364788 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 A364788 Michael De Vlieger, <a href="/A364788/b364788.txt">Table of n, a(n) for n = 0..10000</a> %H A364788 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 A364788 a(1) = 0 because a(0) = 0 has been repeated 0 times. a(2) = 1 because a(1) = 0 has been repeated once. %e A364788 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 A364788 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 A364788 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 *) %o A364788 (Python) %o A364788 from collections import Counter %o A364788 from itertools import count, islice %o A364788 def agen(): # generator of terms %o A364788 an, c = 0, Counter() %o A364788 while True: %o A364788 yield an %o A364788 key = an%10 %o A364788 an = c[key] %o A364788 c[key] += 1 %o A364788 print(list(islice(agen(), 85))) # _Michael S. Branicky_, Mar 24 2025 %Y A364788 Cf. A248034. %K A364788 nonn,base %O A364788 0,5 %A A364788 _David James Sycamore_, Aug 07 2023 %E A364788 More terms from _Michael De Vlieger_, Aug 08 2023