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, Table of n, a(n) for n = 1..10000
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
KEYWORD
AUTHOR
David James Sycamore, May 25 2025
STATUS
approved
