cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-4 of 4 results.

A364448 Lexicographically earliest sequence where n is banned for n^2 terms after each appearance.

Original entry on oeis.org

1, 2, 1, 3, 1, 4, 1, 2, 1, 5, 1, 6, 1, 2, 1, 3, 1, 7, 1, 2, 1, 8, 1, 4, 1, 2, 1, 3, 1, 9, 1, 2, 1, 10, 1, 5, 1, 2, 1, 3, 1, 4, 1, 2, 1, 11, 1, 12, 1, 2, 1, 3, 1, 6, 1, 2, 1, 13, 1, 4, 1, 2, 1, 3, 1, 5, 1, 2, 1, 7, 1, 14, 1, 2, 1, 3, 1, 4, 1, 2, 1, 15, 1, 16, 1, 2, 1, 3, 1, 8, 1, 2, 1, 5, 1, 4
Offset: 1

Views

Author

Rok Cestnik, Jul 25 2023

Keywords

Comments

After 12427560 terms the sequence is periodic with period 2985984. The largest periodic term is 158.
The largest term is 159 which appears only 3 times: a(4942686), a(7756992) and a(9818928).
If banning for n terms the sequence just repeats [1,2,1,3] (A364447). If banning for n^3 terms the sequence continues growing forever (A364449).
The first 41 terms are shared with A028920.

Examples

			a(n)   ban 1  2  3  4  5  6  7  ...
 1         |  |  |  |  |  |  |
 2         x  |  |  |  |  |  |
 1         |  x  |  |  |  |  |
 3         x  x  |  |  |  |  |
 1         |  x  x  |  |  |  |
 4         x  x  x  |  |  |  |
 1         |  |  x  x  |  |  |
 2         x  |  x  x  |  |  |
 1         |  x  x  x  |  |  |
 5         x  x  x  x  |  |  |
 1         |  x  x  x  x  |  |
 6         x  x  x  x  x  |  |
 1         |  |  x  x  x  x  |
 2         x  |  |  x  x  x  |
 1         |  x  |  x  x  x  |
 3         x  x  |  x  x  x  |
 1         |  x  x  x  x  x  |
 7         x  x  x  x  x  x  |
 .
 .
 .
		

Crossrefs

Programs

  • C
    #include
    int main(void){
        int N = 1000;
        int *a = (int*)malloc((N+1)*sizeof(int));
        int *ban = (int*)malloc(160*sizeof(int));
        for(int n = 0; n < N; ++n){
            for(int can = 1; can < 160; ++can){
                if(ban[can] == 0){
                    a[n] = can;
                    ban[can] = can*can+1;
                    break;
                }
            }
            for(int can = 1; can < 160; ++can) if(ban[can]) --ban[can];
        }
        free(a); free(ban);
        return 0;
    }
  • Python
    a = []
    ban = [0 for n in range(160)]
    for i in range(1000):
        can = ban.index(0,1)
        ban = [max(b-1,0) for b in ban]
        a.append(can)
        ban[can] = can**2
    

Formula

a(n) = a(n-2985984) for n >= 15413545.

A364447 Repeat [1,2,1,3].

Original entry on oeis.org

1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1
Offset: 1

Views

Author

Rok Cestnik, Jul 25 2023

Keywords

Comments

Continued fraction of sqrt(5) - 3/2 = 0.7360679... (without integer part); and (4*sqrt(5) + 6)/11 = 1.3585701... (with integer part).
Lexicographically earliest sequence in which n is banned for n terms after each appearance (see A364448 for n^2 and A364449 for n^3).

Crossrefs

Cf. A131743 (repeat [0,1,0,2]).

Programs

  • Mathematica
    PadRight[{}, 100, {1, 2, 1, 3}] (* Paolo Xausa, Jan 23 2025 *)
  • Python
    def A364447(n): return (3,1,2,1)[n&3] # Chai Wah Wu, Jul 29 2023

Formula

a(n) = A131743(n-1) + 1.

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.

Original entry on oeis.org

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

Views

Author

Rok Cestnik, Jul 29 2023

Keywords

Examples

			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
 .
 .
 .
		

Crossrefs

Programs

  • 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 *)
  • 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
    				

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.

Original entry on oeis.org

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

Views

Author

Rok Cestnik, Jul 29 2023

Keywords

Examples

			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  |
 .
 .
 .
		

Crossrefs

Programs

  • 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
    				
Showing 1-4 of 4 results.