login
A364603
Lexicographically earliest sequence where after the m-th appearance of term z, it is banned from re-appearing in the next m*z terms.
3
1, 2, 1, 3, 2, 1, 4, 3, 5, 1, 2, 4, 6, 7, 1, 3, 5, 2, 8, 6, 1, 4, 7, 9, 10, 3, 2, 1, 5, 8, 11, 12, 6, 9, 4, 1, 10, 2, 3, 7, 13, 14, 11, 15, 1, 5, 8, 12, 16, 17, 2, 4, 6, 9, 1, 3, 13, 10, 14, 15, 18, 7, 19, 20, 21, 1, 2, 5, 11, 16, 17, 8, 4, 12, 3, 22, 23, 1, 6, 18, 24, 9, 19, 2, 13, 20, 21, 14
OFFSET
1,2
LINKS
Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^16.
Michael De Vlieger, Plot [b(k) > n] at (x,y) = (n,k), for n = 1..2^12, where k may appear at index b(k) and brackets are Iverson. Hence if b(k) > n, k is banned and shown in black else k is permitted and shown in white. This image is similar to the Example but rotated 90 degrees counterclockwise.
EXAMPLE
a(n) ban 1 2 3 4 5 6 7 ...
1 | | | | | | |
2 x | | | | | |
1 | x | | | | |
3 x x | | | | |
2 x | x | | | |
1 | x x | | | |
4 x x x | | | |
3 x x | x | | |
5 x x x x | | |
1 | | x x x | |
2 x | x x x | |
4 x x x | x | |
6 x x x x x | |
7 x x x x x x |
1 | x | x | x x
3 x x | x | x x
5 x x x x | x x
2 x | x x x x x
8 x x x x x x x
6 x x x x x | x
1 | x x | x x x
.
.
.
MATHEMATICA
c[_] := 0; q[_] := 1; r = k = 1; nn = 120; Do[Set[{a[n], c[k]}, {k, n + k*q[k] + 1}]; q[k]++; If[k > r, r = k]; k = MinimalBy[Range[r], c, 1][[1]]; If[c[k] > n + 1, k = r + 1], {n, nn}]; Array[a, nn] (* Michael De Vlieger, Aug 13 2023 *)
PROG
(PARI) A364603(N) = {my(a=vector(N), z=1); for(s=1, N, if(a[s], next); my(m=0); for(i=s, N, if(!a[i], a[i]=z; i+=(z*(m++)))); z++); a}
(Python)
def A364603(N):
a = [0]*N; z=s=0
while(s<N):
z+=1; m=1; i=s
while(i<N):
if not a[i]:
a[i]=z; i+=z*m; m+=1
i+=1
s+=1
return a
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Rok Cestnik, Jul 29 2023
STATUS
approved