login
A364604
Lexicographically earliest sequence, where after every appearance, a term is banned from re-appearing for twice as long as last time; first appearance bans it for 1 term.
3
1, 2, 1, 2, 3, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 4, 3, 5, 1, 2, 4, 6, 5, 7, 6, 3, 7, 8, 9, 4, 6, 5, 7, 8, 9, 1, 2, 7, 8, 6, 9, 10, 3, 8, 10, 9, 4, 7, 5, 10, 11, 12, 8, 11, 9, 10, 6, 11, 12, 13, 14, 12, 11, 13, 7, 10, 12, 13, 1, 2, 8, 9, 11, 13, 14, 3, 12, 14, 15, 4, 15, 5, 10, 13, 14, 15, 16
OFFSET
1,2
EXAMPLE
a(n) ban 1 2 3 4 5 6 ...
1 | | | | | |
2 x | | | | |
1 | x | | | |
2 x | | | | |
3 x x | | | |
1 | x x | | |
2 x | | | | |
3 x x | | | |
4 x x x | | |
5 x x x x | |
1 | x | | x |
2 x | | | | |
3 x x | | | |
4 x x x | | |
5 x x x x | |
6 x x x x x |
4 x x x | x x
3 x x | x | |
5 x x x x | |
1 | x x x x |
.
.
.
PROG
(PARI) A364604(N) = {my(a=vector(N), z=1); for(s=1, N, if(a[s], next); my(m=-1); for(i=s, N, if(!a[i], a[i]=z; i+=(1<<(m++)))); z++); a}
(Python)
def A364604(N):
a = [0]*N; z=s=0
while(s<N):
z+=1; m=0; i=s
while(i<N):
if not a[i]:
a[i]=z; i+=2**m; m+=1
i+=1
s+=1
return a
CROSSREFS
KEYWORD
nonn
AUTHOR
Rok Cestnik, Jul 29 2023
STATUS
approved