Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #24 Aug 14 2023 02:01:03

%S 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,

%T 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,

%U 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

%N Lexicographically earliest sequence where after the m-th appearance of term z, it is banned from re-appearing in the next m*z terms.

%H Rok Cestnik, <a href="/A364603/b364603.txt">Table of n, a(n) for n = 1..10000</a>

%H Michael De Vlieger, <a href="/A364603/a364603.png">Log log scatterplot of a(n)</a>, n = 1..2^16.

%H Michael De Vlieger, <a href="/A364603/a364603_1.png">Plot [b(k) > n] at (x,y) = (n,k)</a>, 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.

%e a(n) ban 1 2 3 4 5 6 7 ...

%e 1 | | | | | | |

%e 2 x | | | | | |

%e 1 | x | | | | |

%e 3 x x | | | | |

%e 2 x | x | | | |

%e 1 | x x | | | |

%e 4 x x x | | | |

%e 3 x x | x | | |

%e 5 x x x x | | |

%e 1 | | x x x | |

%e 2 x | x x x | |

%e 4 x x x | x | |

%e 6 x x x x x | |

%e 7 x x x x x x |

%e 1 | x | x | x x

%e 3 x x | x | x x

%e 5 x x x x | x x

%e 2 x | x x x x x

%e 8 x x x x x x x

%e 6 x x x x x | x

%e 1 | x x | x x x

%e .

%e .

%e .

%t 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 *)

%o (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}

%o (Python)

%o def A364603(N):

%o a = [0]*N; z=s=0

%o while(s<N):

%o z+=1; m=1; i=s

%o while(i<N):

%o if not a[i]:

%o a[i]=z; i+=z*m; m+=1

%o i+=1

%o s+=1

%o return a

%Y Cf. A364604, A364448, A364449.

%K nonn,look

%O 1,2

%A _Rok Cestnik_, Jul 29 2023

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 18 23:41 EDT 2024. Contains 375284 sequences. (Running on oeis4.)