login
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).
1
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, 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, 27, 17, 28, 18, 29, 19, 30, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 3, 10, 31, 11
OFFSET
1,3
COMMENTS
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.
LINKS
Michael De Vlieger, Log log scatterplot of a(n), n = 1..10^6.
EXAMPLE
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.
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.
MATHEMATICA
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 *)
PROG
(Python)
from itertools import islice
from collections import Counter
def agen(): # generator of terms
an, c = 1, Counter()
while True:
yield an
leading = str(an)[0]
c[leading] += 1
an = c[leading]
print(list(islice(agen(), 80))) # Michael S. Branicky, May 25 2025
CROSSREFS
Sequence in context: A322182 A356348 A336514 * A358851 A249009 A378359
KEYWORD
nonn,base,look
AUTHOR
STATUS
approved