login
A363301
a(1)=1, and thereafter, a(n) is the number of terms in the sequence thus far that appear with a frequency equal to or less than that of a(n-1).
2
1, 1, 2, 1, 4, 2, 3, 2, 8, 3, 4, 5, 2, 13, 3, 11, 4, 13, 5, 6, 3, 21, 4, 23, 5, 13, 14, 6, 7, 6, 18, 7, 8, 9, 6, 35, 7, 21, 10, 7, 40, 8, 22, 9, 12, 9, 26, 10, 13, 49, 10, 27, 11, 14, 15, 10, 56, 11, 30, 12, 17, 12, 34, 13, 64, 14, 37, 15, 18, 19, 14, 66, 15, 40, 20, 15, 71, 16, 17, 24, 17, 44, 18, 46, 19, 24
OFFSET
1,3
LINKS
Neal Gersh Tolunsky, Graph of the first 100000 terms
EXAMPLE
a(3)=2 because a(2)=1 occurs with a frequency of 2 and there are two terms in the sequence thus far that appear with a frequency of 2 or less (1, 1).
a(6)=3 because a(5)=2 occurs with a frequency of 2 and there are three terms that appear with a frequency of 2 or less (2, 2, and 4).
PROG
(Python)
from itertools import islice
from collections import Counter
def agen(): # generator of terms
an, c, freqs = 1, Counter(), Counter()
while True:
if an in c:
freqs[c[an]] -= 1
c[an] += 1
freqs[c[an]] += 1
yield an
an = sum(v*freqs[v] for v in range(1, c[an]+1))
print(list(islice(agen(), 86))) # Michael S. Branicky, May 26 2023
CROSSREFS
Cf. A350768.
Sequence in context: A323901 A132223 A224712 * A135941 A036998 A121464
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, May 26 2023
STATUS
approved