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-10 of 18 results. Next

A002517 Earliest sequence with a(a(n))=3n.

Original entry on oeis.org

0, 2, 3, 6, 5, 12, 9, 8, 21, 18, 11, 30, 15, 14, 39, 36, 17, 48, 27, 20, 57, 24, 23, 66, 63, 26, 75, 54, 29, 84, 33, 32, 93, 90, 35, 102, 45, 38, 111, 42, 41, 120, 117, 44, 129, 108, 47, 138, 51, 50, 147, 144, 53, 156, 81, 56, 165, 60, 59, 174, 171, 62, 183, 72, 65, 192
Offset: 0

Views

Author

Keywords

Comments

a(3*n+1) = A016789(n), a(3*n+2) = A017197(n). - Reinhard Zumkeller, Jun 04 2015

Crossrefs

Cf. A007494 (sorted), A016789, A017197.

Programs

  • Haskell
    import Data.List (transpose)
    a002517 n = a002517_list !! n
    a002517_list = 0 : concat
       (transpose [[2, 5 ..], [3, 12 ..], map (* 3) $ tail a002517_list])
    -- Reinhard Zumkeller, Jun 04 2015
  • Mathematica
    a[n_] := a[n] = Which[ Mod[n, 3] == 0, 3*a[n/3], Mod[n, 3] == 1, n+1, True, 3*(n-1)]; Table[a[n], {n, 0, 65}] (* Jean-François Alcover, Sep 24 2012 *)

Formula

a(3n)=3*a(n), a(3n+1)=3n+2, a(3n+2)=9n+3

Extensions

Formula and more terms from Henry Bottomley, Apr 27 2000

A007379 Earliest sequence with a(a(n)) = 4n.

Original entry on oeis.org

0, 2, 4, 5, 8, 12, 7, 24, 16, 10, 36, 13, 20, 44, 15, 56, 32, 18, 68, 21, 48, 76, 23, 88, 28, 26, 100, 29, 96, 108, 31, 120, 64, 34, 132, 37, 40, 140, 39, 152, 144, 42, 164, 45, 52, 172, 47, 184, 80, 50, 196, 53, 176, 204, 55, 216, 60, 58, 228, 61, 224, 236, 63, 248
Offset: 0

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = Which[ Mod[n, 8] == 0, 4*a[n/4], Mod[n, 8] == 1, n+1, Mod[n, 8] == 2, 4*(n-2)+4, Mod[n, 8] == 3, n+2, Mod[n, 8] == 4, 4*a[(n-4)/4+1], Mod[n, 8] == 5, 4*(n-5) + 12, Mod[n, 8] == 6, n+1, True, 4*(n-7)+24]; a[0] = 0; Table[ a[n], {n, 0, 63}] (* Jean-François Alcover, Sep 24 2012 *)

Formula

a(8n)=4*a(2n), a(8n+1)=8n+2, a(8n+2)=32n+4, a(8n+3)=8n+5, a(8n+4)=4*a(2n+1), a(8n+5)=32n+12, a(8n+6)=8n+7, a(8n+7)=32n+24

Extensions

Formula and more terms from Henry Bottomley, Apr 27 2000

A339929 a(n+1) = a(n-1-a(n)^2) + 1, starting with a(1) = a(2) = 0.

Original entry on oeis.org

0, 0, 1, 1, 1, 2, 1, 2, 2, 2, 2, 3, 1, 3, 2, 3, 3, 2, 2, 4, 2, 4, 2, 3, 4, 3, 4, 3, 3, 3, 5, 2, 5, 2, 4, 3, 4, 5, 4, 5, 4, 4, 5, 4, 5, 3, 4, 4, 6, 4, 6, 4, 5, 5, 4, 6, 3, 5, 3, 7, 3, 7, 4, 4, 5, 5, 6, 4, 7, 3, 8, 3, 8, 3, 5, 7, 4, 8, 2, 4, 5, 5, 7, 6, 5, 4, 8, 5, 8, 4, 9, 3, 6, 7, 5
Offset: 1

Views

Author

Rok Cestnik, Dec 23 2020

Keywords

Comments

To obtain the next term, square the current term and add 1, then count back this number and add 1.
The sequence cannot repeat. Proof: Assume a finite period. Label an arbitrary term in the period x. Because of the back-referencing definition it follows that x-1 has to be in the period, and by the same argument so does x-2 and x-3, x-4, ... until 0. But it is not possible to obtain new 0s since each new term is larger than one already existing term.
Every positive integer appears in the sequence.
First occurrence of n: 1, 3, 6, 12, 20, 31, 49, 60, 71, 91, 129, 163, 214, 265, 303, 354, 516, 594, 792, 915, ...
The sequence appears to grow with the cube root of n, which is expected since f(x) = (3*x)^(1/3) satisfies the definition for large x, i.e., lim_{x->oo} f(x+1)-(f(x-1-f(x)^2)+1) = 0.
The width of the distribution of terms within a range (n^2,n^2+n) appears to be constant for large n and can be defined as: lim_{n->oo} ( 1/n*Sum_{k=n..2n} ( Max_{i=k^2..k^2+k} a(i) - Min_{i=k^2..k^2+k} a(i) ) ) and evaluates to 12.98... (for n^2 = 5*10^8).
Each term is determined by referencing an earlier term. Following the chain of these references we can uniquely trace back every term to one of the two initial zeros, e.g., a(60) -> a(49) -> a(31) -> a(20) -> a(14) -> a(11) -> a(5) -> a(2). These progressions form two trees, with the zeros being at their roots (for visualization see the Links section). The average branching factor B (number of links divided by the number of non-leaf nodes) is numerically evaluated to B = 1.51803... (for n = 10^8). Considering the asymptotic behavior of the sequence a(n) ~ (3*n)^(1/3), we can conclude that the number of links within a range (n,m) is asymptotically equal to m-n and therefore B is the inverse of the proportion of non-leaf terms (B = 1.518... then implies that roughly 34% of all terms never get referenced).
An extended definition can be considered that only requires one initial value: a(0) = -1, and the next terms are obtained via a(n+1) = a(n-1-a(n)*|a(n)|)+1.

Examples

			a(3) = a(2-1-a(2)^2)+1 = a(1)+1 = 1.
a(4) = a(3-1-a(3)^2)+1 = a(1)+1 = 1.
a(5) = a(4-1-a(4)^2)+1 = a(2)+1 = 1.
a(6) = a(5-1-a(5)^2)+1 = a(3)+1 = 2.
		

Crossrefs

Analogous sequences: A339930, A339931, A339932.

Programs

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

Formula

a(n) ~ (3*n)^(1/3) (conjectured).

A002518 Earliest sequence with a(a(n))=5n.

Original entry on oeis.org

0, 2, 5, 4, 15, 10, 7, 30, 9, 40, 25, 12, 55, 14, 65, 20, 17, 80, 19, 90, 75, 22, 105, 24, 115, 50, 27, 130, 29, 140, 35, 32, 155, 34, 165, 150, 37, 180, 39, 190, 45, 42, 205, 44, 215, 200, 47, 230, 49, 240, 125, 52, 255, 54, 265, 60, 57, 280, 59, 290, 275, 62, 305
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = Which[ Mod[n, 5] == 0, 5*a[n/5], Mod[n, 5] == 1, n+1, Mod[n, 5] == 2, 5*(n-2)+5, Mod[n, 5] == 3, n+1, True, 5*(n-4)+15]; a[0] = 0; Table[ a[n], {n, 0, 62}] (* Jean-François Alcover, Sep 24 2012 *)

Formula

a(5n)=5*a(n), a(5n+1)=5n+2, a(5n+2)=25n+5, a(5n+3)=5n+4, a(5n+4)=25n+15

Extensions

Corrected description and more terms from Henry Bottomley, Apr 27 2000

A339930 a(n+1) = a(n-2-a(n)^2) + 1, starting with a(1) = a(2) = a(3) = 0.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 3, 2, 3, 2, 3, 3, 2, 4, 2, 4, 2, 4, 3, 3, 4, 3, 4, 3, 3, 5, 2, 5, 2, 5, 3, 4, 5, 3, 5, 3, 4, 4, 4, 5, 3, 6, 3, 5, 3, 4, 6, 4, 6, 4, 5, 4
Offset: 1

Views

Author

Rok Cestnik, Dec 23 2020

Keywords

Comments

To obtain the next term, square the current term and add 2, then count back this number and add 1.
The sequence cannot repeat. Proof: Assume a finite period. Label an arbitrary term in the period x. Because of the back-referencing definition it follows that x-1 has to be in the period, and by the same argument so does x-2 and x-3, x-4,... until 0. But it is not possible to obtain new 0s since each new term is larger than one already existing term.
Every positive integer appears in the sequence.
First occurrence of n: 1, 4, 8, 15, 22, 34, 50, 69, 108, 171, 210, 277, 376, 464, 567, 670, 775, 993,...
The sequence appears to grow with the cube root of n, which is expected since f(x) = (3*x)^(1/3) satisfies the definition for large x, i.e. lim_{x->oo} f(x+1)-(f(x-2-f(x)^2)+1) = 0.
The width of the distribution of terms within a range (n^2,n^2+n) appears to be constant for large n and can be defined as: lim_{n->oo} ( 1/n*Sum_{k=n..2n} ( Max_{i=k^2..k^2+k} a(i) - Min_{i=k^2..k^2+k} a(i) ) ) and evaluates to 7.41... (for n^2 = 5*10^8).

Examples

			a(4) = a(3-2-a(3)^2)+1 = a(1)+1 = 1.
a(5) = a(4-2-a(4)^2)+1 = a(1)+1 = 1.
a(6) = a(5-2-a(5)^2)+1 = a(2)+1 = 1.
a(7) = a(6-2-a(6)^2)+1 = a(3)+1 = 1.
a(8) = a(7-2-a(7)^2)+1 = a(4)+1 = 2.
		

Crossrefs

Analogous sequences: A339929, A339931, A339932.

Programs

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

Formula

a(n) ~ (3*n)^(1/3) (conjectured).

A339931 a(n+1) = a(n-3-a(n)^2) + 1, starting with a(1) = a(2) = a(3) = a(4) = 0.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 3, 2, 3, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 3, 4, 3, 4, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 5, 4, 5, 4, 5, 4, 4, 5, 4, 5
Offset: 1

Views

Author

Rok Cestnik, Dec 23 2020

Keywords

Comments

To obtain the next term, square the current term and add 3, then count back this number and add 1.
The sequence cannot repeat. Proof: Assume a finite period. Label an arbitrary term in the period x. Because of the back-referencing definition it follows that x-1 has to be in the period, and by the same argument so does x-2 and x-3, x-4,... until 0. But it is not possible to obtain new 0s since each new term is larger than one already existing term.
Every positive integer appears in the sequence.
First occurrence of n: 1, 5, 10, 18, 31, 51, 71, 100, 140, 221, 283, 351, 487, 612, 737, 885,...
The sequence appears to grow with the cube root of n, which is expected since f(x) = (3*x)^(1/3) satisfies the definition for large x, i.e. lim_{x->oo} f(x+1)-(f(x-3-f(x)^2)+1) = 0.
The width of the distribution of terms within a range (n^2,n^2+n) appears to be constant for large n and can be defined as: lim_{n->oo} ( 1/n*Sum_{k=n..2n} ( Max_{i=k^2..k^2+k} a(i) - Min_{i=k^2..k^2+k} a(i) ) ) and evaluates to 7.40... (for n^2 = 5*10^8).

Examples

			a(5) = a(4-3-a(4)^2)+1 = a(1)+1 = 1.
a(6) = a(5-3-a(5)^2)+1 = a(1)+1 = 1.
a(7) = a(6-3-a(6)^2)+1 = a(2)+1 = 1.
a(8) = a(7-3-a(7)^2)+1 = a(3)+1 = 1.
a(9) = a(8-3-a(8)^2)+1 = a(4)+1 = 1.
a(10) = a(9-3-a(9)^2)+1 = a(5)+1 = 2.
		

Crossrefs

Analogous sequences: A339929, A339930, A339932.

Programs

  • C
    #include
    #include
    int main(void){
        int N = 1000;
        int *a = (int*)malloc(N*sizeof(int));
        a[0] = 0;
        a[1] = 0;
        a[2] = 0;
        a[3] = 0;
        for(int n = 3; n < N-1; ++n){
            a[n+1] = a[n-3-a[n]*a[n]]+1;
        }
        free(a);
        return 0;
    }
  • Python
    a = [0, 0, 0, 0]
    for n in range(3, 1000):
        a.append(a[n-3-a[n]**2]+1)
    

Formula

a(n) ~ (3*n)^(1/3) (conjectured).

A339932 a(n+1) = a(n-4-a(n)^2) + 1, starting with a(1) = a(2) = a(3) = a(4) = a(5) = 0.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 3, 2, 3, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 3, 4, 3, 4, 3, 4, 4, 3, 5, 3, 5, 3, 5, 3, 4, 5, 3, 5, 4, 5
Offset: 1

Views

Author

Rok Cestnik, Dec 23 2020

Keywords

Comments

To obtain the next term, square the current term and add 4, then count back this number and add 1.
The sequence cannot repeat. Proof: Assume a finite period. Label an arbitrary term in the period x. Because of the back-referencing definition it follows that x-1 has to be in the period, and by the same argument so does x-2 and x-3, x-4,... until 0. But it is not possible to obtain new 0s since each new term is larger than one already existing term.
Every positive integer appears in the sequence.
First occurrence of n: 1, 6, 12, 21, 35, 49, 70, 100, 130, 171, 212, 266, 320, 406, 564, 669, 849,...
The sequence appears to grow with the cube root of n, which is expected since f(x) = (3*x)^(1/3) satisfies the definition for large x, i.e. lim_{x->oo} f(x+1)-(f(x-4-f(x)^2)+1) = 0.
The width of the distribution of terms within a range (n^2,n^2+n) appears to be constant for large n and can be defined as: lim_{n->oo} ( 1/n*Sum_{k=n..2n} ( Max_{i=k^2..k^2+k} a(i) - Min_{i=k^2..k^2+k} a(i) ) ) and evaluates to 8.10... (for n^2 = 5*10^8).

Examples

			a(6) = a(5-4-a(5)^2)+1 = a(1)+1 = 1.
a(7) = a(6-4-a(6)^2)+1 = a(1)+1 = 1.
a(8) = a(7-4-a(7)^2)+1 = a(2)+1 = 1.
a(9) = a(8-4-a(8)^2)+1 = a(3)+1 = 1.
a(10) = a(9-4-a(9)^2)+1 = a(4)+1 = 1.
a(11) = a(10-4-a(10)^2)+1 = a(5)+1 = 1.
a(12) = a(11-4-a(11)^2)+1 = a(6)+1 = 2.
		

Crossrefs

Analogous sequences: A339929, A339930, A339931.

Programs

  • C
    #include
    #include
    int main(void){
        int N = 1000;
        int *a = (int*)malloc(N*sizeof(int));
        a[0] = 0;
        a[1] = 0;
        a[2] = 0;
        a[3] = 0;
        a[4] = 0;
        for(int n = 4; n < N-1; ++n){
            a[n+1] = a[n-4-a[n]*a[n]]+1;
        }
        free(a);
        return 0;
    }
  • Python
    a = [0, 0, 0, 0, 0]
    for n in range(4, 1000):
        a.append(a[n-4-a[n]**2]+1)
    

Formula

a(n) ~ (3*n)^(1/3) (conjectured).

A340224 a(n+1) = a(n-a(n)*(a(n)-1)/2) + 1, starting with a(1) = 0.

Original entry on oeis.org

0, 1, 2, 2, 3, 2, 4, 1, 2, 2, 3, 2, 4, 5, 3, 3, 5, 5, 2, 6, 4, 4, 4, 6, 3, 5, 4, 5, 6, 6, 4, 4, 6, 6, 3, 5, 6, 5, 6, 7, 3, 6, 5, 7, 5, 4, 8, 3, 6, 7, 7, 7, 5, 6, 7, 7, 4, 8, 7, 6, 6, 5, 8, 4, 9, 7, 6, 8, 8, 4, 5, 7, 8, 6, 8, 9, 8, 7, 5, 9, 8, 6, 7, 6, 9, 7, 10, 7, 7, 9, 7, 5, 7, 8, 8
Offset: 1

Views

Author

Rok Cestnik, Jan 01 2021

Keywords

Comments

To obtain the next term, compute the binomial(a,2) with the current term, then count back its value and add 1.
The sequence cannot repeat. Proof: Assume a finite period. Label an arbitrary term in the period x. Because of the back-referencing definition it follows that x-1 has to be in the period, and by the same argument so does x-2 and x-3, x-4, ... until 0. But it is not possible to obtain new 0s since each new term is larger than one already existing term.
Every positive integer appears in the sequence.
First occurrence of n: 1, 2, 3, 5, 7, 14, 20, 40, 47, 65, 87, 124, 170, 210, 258, 310, 389, 469, 548, 640, 758, 864, ...
The sequence appears to grow with the cube root of n, which is expected since f(x) = (6*x)^(1/3) satisfies the definition for large x, i.e., lim_{x->oo} f(x+1)-(f(x-f(x)*(f(x)-1)/2)+1) = 0.
Each term is determined by referencing an earlier term. Following the chain of these references we can uniquely trace back every term to the initial zero, e.g., a(40) -> a(24) -> a(17) -> a(13) -> a(11) -> a(9) -> a(8) -> a(1). These progressions form a tree, with the zero being at its root (for visualization see the Links section). The average branching factor B (number of links divided by the number of non-leaf nodes) is numerically evaluated to B = 1.380... (for n = 10^8). Considering the asymptotic behavior of the sequence a(n) ~ (6*n)^(1/3), we can expect that the number of links within a range (n,m) is asymptotically equal to m-n and therefore B is the inverse of the proportion of non-leaf terms (B = 1.380... then implies that roughly 27.5% of all terms never get referenced).

Examples

			a(2) = a(1-a(1)*(a(1)-1)/2)+1 = a(1)+1 = 1.
a(3) = a(2-a(2)*(a(2)-1)/2)+1 = a(2)+1 = 2.
a(4) = a(3-a(3)*(a(3)-1)/2)+1 = a(2)+1 = 2.
a(5) = a(4-a(4)*(a(4)-1)/2)+1 = a(3)+1 = 3.
		

Crossrefs

Related to A339929.

Programs

  • Python
    a = [0]
    for n in range(1000):
        a.append(a[int(n-a[n]*(a[n]-1)/2)]+1)

Formula

a(n) ~ (6*n)^(1/3) (conjectured).

A364197 a(n+1) = a(|n-a(n)^2|) + 1, a(0) = 0.

Original entry on oeis.org

0, 1, 1, 2, 2, 1, 3, 3, 2, 3, 1, 4, 2, 3, 3, 2, 5, 4, 2, 4, 3, 5, 3, 4, 4, 3, 6, 2, 5, 3, 4, 4, 3, 5, 3, 4, 5, 5, 3, 4, 5, 3, 4, 7, 4, 6, 4, 5, 4, 4, 6, 4, 5, 3, 5, 4, 5, 5, 4, 5, 4, 5, 6, 7, 4, 5, 6, 5, 5, 8, 2, 7, 4, 6, 6, 4, 6, 6, 4, 7, 5, 5, 6, 5, 5, 6, 5, 6, 5, 8, 4, 7, 5, 6, 6, 5, 3, 7, 5, 7
Offset: 0

Views

Author

Rok Cestnik, Jul 13 2023

Keywords

Examples

			a(1) = a(|0-a(0)^2|)+1 = a(|0-0|)+1 = a(0)+1 = 1.
a(2) = a(|1-a(1)^2|)+1 = a(|1-1|)+1 = a(0)+1 = 1.
a(3) = a(|2-a(2)^2|)+1 = a(|2-1|)+1 = a(1)+1 = 2.
a(4) = a(|3-a(3)^2|)+1 = a(|3-4|)+1 = a(1)+1 = 2.
a(5) = a(|4-a(4)^2|)+1 = a(|4-4|)+1 = a(0)+1 = 1.
		

Crossrefs

Cf. A364198 (indices of record highs).

Programs

  • Mathematica
    a[0] = 0; a[n_] := a[n] = a[Abs[n - 1 - a[n - 1]^2]] + 1; Array[a, 100, 0] (* Amiram Eldar, Jul 13 2023 *)
  • Python
    a = [0]; [a.append(a[abs(n-a[n]**2)]+1) for n in range(100)]

Formula

a(n) ~ (3n)^(1/3) (conjectured).

A054791 Earliest sequence with a(a(n)) = n^2.

Original entry on oeis.org

0, 1, 3, 4, 9, 6, 25, 8, 49, 16, 11, 100, 13, 144, 15, 196, 81, 18, 289, 20, 361, 22, 441, 24, 529, 36, 27, 676, 29, 784, 31, 900, 33, 1024, 35, 1156, 625, 38, 1369, 40, 1521, 42, 1681, 44, 1849, 46, 2025, 48, 2209, 64, 51, 2500, 53, 2704, 55, 2916, 57, 3136, 59
Offset: 0

Views

Author

Henry Bottomley, Apr 27 2000

Keywords

Crossrefs

Cf. A002516.

Programs

  • Haskell
    a054791 n = a054791_list `genericIndex` n
    a054791_list = 0 : 1 : f 2 where
       f x | r ^ 2 == x  = a054791 r ^ 2 : f (x + 1)
           | odd (x - r) = x + 1         : f (x + 1)
           | otherwise   = (x - 1) ^ 2   : f (x + 1)
           where r = a000196 x
    -- Reinhard Zumkeller, Oct 27 2013
  • Mathematica
    a[n_] := a[n] = Which[r = Sqrt[n]; IntegerQ[r], a[r]^2, OddQ[n - Floor[r]^2], n+1, True, (n-1)^2]; a[0]=0; a[1]=1; Table[a[n], {n, 0, 58}] (* Jean-François Alcover, Aug 07 2012, after formula *)

Formula

if n is a square then a(n) = a(sqrt(n))^2, otherwise if the difference between n and the highest square less than n is odd then a(n) = n+1, otherwise a(n) = (n-1)^2.
Showing 1-10 of 18 results. Next