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).

Original entry on oeis.org

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

Views

Author

David James Sycamore, May 25 2025

Keywords

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.

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
  • 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