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, 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
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.
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.
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
Comments