cp's OEIS Frontend

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.

A384309 a(1) = 1. Thereafter a(n) is the cardinality of the set of terms whose leading decimal digit is the same as that of a(n-1).

This page as a plain text file.
%I A384309 #32 Jul 21 2025 07:39:36
%S A384309 1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,11,12,13,14,15,16,17,18,19,20,
%T A384309 2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,21,11,22,12,23,13,24,14,25,15,26,16,
%U A384309 27,17,28,18,29,19,30,3,4,3,5,3,6,3,7,3,8,3,9,3,10,31,11
%N A384309 a(1) = 1. Thereafter a(n) is the cardinality of the set of terms whose leading decimal digit is the same as that of a(n-1).
%C A384309 Conjecture: All positive integers appear precisely 9 times in this sequence, except for 1, which appears 10 times. For k >= 1, the last k digit term in the sequence is a(23[k-1]93) = [k]9 where "[m]9" means a run of m nines; see Example.
%H A384309 Michael De Vlieger, <a href="/A384309/b384309.txt">Table of n, a(n) for n = 1..10000</a>
%H A384309 Michael De Vlieger, <a href="/A384309/a384309.png">Log log scatterplot of a(n)</a>, n = 1..10^6.
%e A384309 a(1) = 1 is given so a(2) = 1, the number of terms having leading decimal digit = 1. Now there are two terms with leading digit = 1, so a(3) = 2. Since a(3) is the only term with leading digit = 2, a(4) = 1.
%e A384309 a(233) = 9 is the last one-digit term, a(2393) = 99 is the last two-digit term, a(23993) = 999 is the last three-digit term, etc.
%t A384309 nn = 120; c[_] := 0; d[x_] := First@ IntegerDigits[x]; j = 1; {j}~Join~Reap[Do[Sow[k = ++c[d[j]]]; j = k, {n, nn}] ][[-1, 1]] (* _Michael De Vlieger_, May 25 2025 *)
%o A384309 (Python)
%o A384309 from itertools import islice
%o A384309 from collections import Counter
%o A384309 def agen(): # generator of terms
%o A384309     an, c = 1, Counter()
%o A384309     while True:
%o A384309         yield an
%o A384309         leading = str(an)[0]
%o A384309         c[leading] += 1
%o A384309         an = c[leading]
%o A384309 print(list(islice(agen(), 80))) # _Michael S. Branicky_, May 25 2025
%Y A384309 Cf. A000030, A248034.
%K A384309 nonn,base,look
%O A384309 1,3
%A A384309 _David James Sycamore_, May 25 2025