A109167 a(n) = least nonnegative integer such that n appears a(n) times.
1, 2, 1, 0, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18
Offset: 0
Examples
Note that we do not need to specify a(0) explicitly. Indeed, a(0) = 1 as it cannot be 0. a(1) = 2 as it cannot be 0 or 1.
Links
- Michael S. Branicky, Table of n, a(n) for n = 0..10000
Programs
-
Python
from itertools import count, islice def agen(): # generator of terms alst = [1, 2, 1, 0, 4, 4, 4, 4] yield from alst for n in count(5): add = [n]*alst[n] yield from add alst.extend(add) print(list(islice(agen(), 79))) # Michael S. Branicky, Aug 25 2025
Comments