A372704 a(1)=1; a(2)=2; for n>1, this is the lexicographically earliest sequence such that, following each occurrence of a(n), a(n) is banned for the next k terms, where k is the number of terms prior to a(n) that are not equal to a(n).
1, 2, 1, 2, 1, 3, 2, 1, 4, 5, 6, 2, 1, 3, 7, 8, 9, 4, 10, 5, 2, 1, 6, 11, 12, 13, 3, 14, 15, 7, 16, 8, 17, 9, 4, 18, 19, 2, 1, 5, 10, 20, 21, 22, 6, 23, 24, 11, 25, 12, 26, 3, 13, 27, 28, 14, 29, 15, 7, 30, 31, 16, 8, 32, 33, 17, 9, 4, 34, 35, 2, 1, 18, 19, 36
Offset: 1
Keywords
Examples
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
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
- Neal Gersh Tolunsky, Graph of first differences of first 20000 terms.
Programs
-
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
Extensions
a(20) and beyond from Michael S. Branicky, May 10 2024
Comments