OFFSET
1,2
COMMENTS
1 occurs immediately after its ban ends so that the i-th occurrence of a(n) = 1, for i >= 2, is at n = 2^(i-2) + i = A052968(i-1).
2 occurs immediately after its ban ends, since it turns out that's immediately before the ban on 1 ends, so the i-th occurrence of a(n) = 2 is at n = 2^(i-1) + i = A005126(i-1).
If the definition is changed so that k is the number of terms in the sequence thus far equal to a(n) (rather than unequal), this becomes A002260 without the initial 1.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
Neal Gersh Tolunsky, Graph of first differences of first 20000 terms.
EXAMPLE
a(n) ban 1 2 3 4 5 6 ...
1 | | | | | |
2 | | | | | |
1 | x | | | |
2 x | | | | |
1 | x | | | |
3 x x | | | |
2 x | x | | |
1 | x x | | |
4 x x x | | |
5 x x x x | |
6 x x x x x |
2 x | | x x x
1 | x | x x x
3 x x x x x x
PROG
(Python)
from collections import Counter
from itertools import count, islice
def agen(): # generator of terms
an, ban, occurs = 1, {1: 1}, Counter([1])
for n in count(2):
yield an
an = next(k for k in count(1) if k not in ban)
for k in list(ban):
if ban[k] > 1: ban[k] -= 1
else: del ban[k]
ban[an] = n - 1 - occurs[an]
occurs[an] += 1
print(list(islice(agen(), 75))) # Michael S. Branicky, May 10 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, May 10 2024
EXTENSIONS
a(20) and beyond from Michael S. Branicky, May 10 2024
STATUS
approved