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

A213196 Inverse permutation of A211377.

Original entry on oeis.org

1, 4, 2, 3, 5, 6, 11, 7, 8, 12, 13, 9, 10, 14, 15, 22, 16, 17, 23, 24, 18, 19, 25, 26, 20, 21, 27, 28, 37, 29, 30, 38, 39, 31, 32, 40, 41, 33, 34, 42, 43, 35, 36, 44, 45, 56, 46, 47, 57, 58, 48, 49, 59, 60, 50, 51, 61, 62, 52, 53, 63, 64, 54, 55, 65, 66, 79
Offset: 1

Views

Author

Boris Putievskiy, Mar 01 2013

Keywords

Examples

			The start of the sequence as triangle array read by rows:
  1;
  4,2;
  3,5,6;
  11,7,8,12;
  13,9,10,14,15;
  22,16,17,23,24,18;
  19,25,26,20,21,27,28;
  . . .
The start of the sequence as array read by rows, the length of row r is 4*r-3.
First 2*r-2 numbers are from the row number 2*r-2 of above triangle array.
Last  2*r-1 numbers are from the row number 2*r-1 of above triangle array.
  1;
  4,2,3,5,6;
  11,7,8,12,13,9,10,14,15;
  22,16,17,23,24,18,19,25,26,20,21,27,28;
Row number r contains permutation of 4*r-3 numbers from 2*r*r-5*r+4 to 2*r*r-r: 2*r*r-3*r+2, 2*r*r-5*r+4, 2*r*r-5*r+5,... 2*r*r-r-1, 2*r*r-r.
		

Crossrefs

Cf. A211377.

Programs

  • Python
    t=int((math.sqrt(8*n-7) - 1)/ 2)
    i=n-t*(t+1)/2
    j=(t*t+3*t+4)/2-n
    m1=(3*i+j-1-(-1)**i+(i+j-2)*(-1)**(i+j))/4
    m2=((1+(-1)**i)*((1+(-1)**j)*2*int((j+2)/4)-(-1+(-1)**j)*(2*int((i+4)/4)+2*int(j/2)))-(-1+(-1)**i)*((1+(-1)**j)*(1+2*int(i/4)+2*int(j/2))-(-1+(-1)**j)*(1+2*int(j/4))))/4
    result=(m1+m2-1)*(m1+m2-2)/2+m1

Formula

a(n)=(m1+m2-1)*(m1+m2-2)/2+m1, where
m1=(3*i+j-1-(-1)^i+(i+j-2)*(-1)*t)/4,
m2=((1+(-1)^i)*((1+(-1)^j)*2*int((j+2)/4)-(-1+(-1)^j)*(2*int((i+4)/4)+2*int(j/2)))-(-1+(-1)^i)*((1+(-1)^j)*(1+2*int(i/4)+2*int(j/2))-(-1+(-1)^j)*(1+2*int(j/4))))/4,
i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2).

A213194 First inverse function (numbers of rows) for pairing function A211377.

Original entry on oeis.org

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

Views

Author

Boris Putievskiy, Mar 01 2013

Keywords

Examples

			The start of the sequence as triangle array read by rows:
  1;
  1,1;
  2,2,3;
  1,1,2,2;
  3,3,4,4,5;
  1,1,2,2,3,3;
  4,4,5,5,6,6,7;
  1,1,2,2,3,3,4,4;
  5,5,6,6,7,7,8,8,9;
  1,1,2,2,3,3,4,4,5,5;
  . . .
The start of the sequence as array read by rows, the length of row r is 4*r-3.
First 2*r-2 numbers are from the row number 2*r-2 of above triangle array.
Last  2*r-1 numbers are from the row number 2*r-1 of above triangle array.
  1;
  1,1,2,2,3;
  1,1,2,2,3,3,4,4,5;
  1,1,2,2,3,3,4,4,5,5,6,6,7;
  1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9;
  . . .
Row r contains numbers 1,2,3,...2*r-2 repeated twice, row ends 2*r-1.
		

Crossrefs

Programs

  • Python
    t=int((math.sqrt(8*n-7) - 1)/ 2)
    i=n-t*(t+1)/2
    j=(t*t+3*t+4)/2-n
    result=(3*i+j-1-(-1)**i+(i+j-2)*(-1)**(i+j))/4

Formula

a(n) = (3*A002600(n)+A004736(n)-1-(-1)^A002260(n)+A003056(n)*(-1)^A003057(n))/4;
a(n) = (3*i+j-1-(-1)^i+(i+j-2)*(-1)*t)/4, where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2).

A213195 Second inverse function (of columns) for pairing function A211377.

Original entry on oeis.org

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

Views

Author

Boris Putievskiy, Mar 01 2013

Keywords

Examples

			The start of the sequence as triangle array read by rows:
  1;
  3,2;
  1,2,1;
  5,4,3,4;
  3,2,1,2,1;
  7,6,5,6,5,4;
  3,4,3,2,1,2,1;
  . . .
The start of the sequence as array read by rows, the length of row r is 4*r-3.
First 2*r-2 numbers are from the row number 2*r-2 of above triangle array.
Last  2*r-1 numbers are from the row number 2*r-1 of above triangle array.
  1;
  3,2,1,2,1;
  5,4,3,4,3,2,1,2,1;
  7,6,5,6,5,4,3,4,3,2,1,2,1;
  ...
Row number r is 2*r-1, 2*r-2, 2*r-3, 2*r-2, {row number r-1}.
		

Crossrefs

Cf. A211377.

Programs

  • Python
    t=int((math.sqrt(8*n-7) - 1)/ 2)
    i=n-t*(t+1)/2
    j=(t*t+3*t+4)/2-n
    result=((1+(-1)**i)*((1+(-1)**j)*2*int((j+2)/4)-(-1+(-1)**j)*(2*int((i+4)/4)+2*int(j/2)))-(-1+(-1)**i)*((1+(-1)**j)*(1+2*int(i/4)+2*int(j/2))-(-1+(-1)**j)*(1+2*int(j/4))))/4

Formula

See Python program.

A213171 T(n,k) = ((k+n)^2 - 4*k + 3 - (-1)^n - (k+n)*(-1)^(k+n))/2; n, k > 0, read by antidiagonals.

Original entry on oeis.org

1, 4, 5, 2, 3, 6, 9, 10, 13, 14, 7, 8, 11, 12, 15, 18, 19, 22, 23, 26, 27, 16, 17, 20, 21, 24, 25, 28, 31, 32, 35, 36, 39, 40, 43, 44, 29, 30, 33, 34, 37, 38, 41, 42, 45, 48, 49, 52, 53, 56, 57, 60, 61, 64, 65, 46, 47, 50, 51, 54, 55, 58, 59, 62, 63, 66, 69
Offset: 1

Views

Author

Boris Putievskiy, Feb 14 2013

Keywords

Comments

Permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Enumeration table T(n,k). The order of the list:
T(1,1) = 1;
T(1,3), T(2,2), T(1,2), T(2,1), T(3,1);
. . .
T(1,n), T(2,n-1), T(1,n-1), T(2,n-2), T(3,n-2), T(4,n-3)...T(n,1);
...
Descent by snake along two adjacent antidiagonals - step to the southwest, step to the north, step to the southwest, step to the south and so on. The length of each step is 1. Phase four steps is rotated 90 degrees counterclockwise and the mirror of the phase A211377.
Table contains the following:
row 1 is alternation of elements A130883 and A100037,
row 2 accommodates elements A033816 in even places;
column 1 is alternation of elements A000384 and A014106,
column 2 is alternation of elements A091823 and A071355,
column 4 accommodates elements A130861 in odd places;
main diagonal is alternation of elements A188135 and A033567,
diagonal 1, located above the main diagonal, accommodates elements A033585 in even places,
diagonal 2, located above the main diagonal, accommodates elements A139271 in odd places,
diagonal 3, located above the main diagonal, is alternation of elements A033566 and A194431.

Examples

			The start of the sequence as a table:
   1   4   2   9   7   8  16 ...
   5   3  10   8  19  17  32 ...
   6  13  11  22  20  35  33 ...
  14  12  23  21  36  34  53 ...
  15  26  24  39  37  56  54 ...
  27  25  40  38  57  55  78 ...
  28  43  41  60  58  81  79 ...
  ...
The start of the sequence as a triangle array read by rows:
   1
   4  5
   2  3  6
   9 10 13 14
   7  8 11 12 15
  18 19 22 23 26 27
  16 17 20 21 24 25 28
  ...
The start of the sequence as array read by rows, the length of row r is 4*r-3.
First 2*r-2 numbers are from the row number 2*r-2 of triangle array, located above.
Last 2*r-1 numbers are from the row number 2*r-1 of triangle array, located above.
   1
   4  5  2  3  6
   9 10 13 14  7  8 11 12 15
  18 19 22 23 26 27 16 17 20 21 24 25 28
  ...
Row number r contains permutation 4*r-3 numbers from 2*r*r-5*r+4 to 2*r*r-r:
2*r*r-5*r+6, 2*r*r-5*r+7, ..., 2*r*r-r-4, 2*r*r-r-3, 2*r*r-r.
		

Crossrefs

Programs

  • Maple
    T:=(n,k)->((k+n)^2-4*k+3-(-1)^n-(k+n)*(-1)^(k+n))/2: seq(seq(T(k,n-k),k=1..n-1),n=1..13); # Muniru A Asiru, Dec 06 2018
  • Mathematica
    T[n_, k_] := ((n+k)^2 - 4k + 3 - (-1)^n - (-1)^(n+k)(n+k))/2;
    Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Dec 06 2018 *)
  • Python
    t=int((math.sqrt(8*n-7) - 1)/ 2)
    i=n-t*(t+1)/2
    j=(t*t+3*t+4)/2-n
    result=((t+2)**2-4*j+3-(-1)**i-(t+2)*(-1)**t)/2

Formula

As a table:
T(n,k) = ((k+n)^2-4*k+3-(-1)^n-(k+n)*(-1)^(k+n))/2.
As a linear sequence:
a(n) = (A003057(n)^2-4*A004736(n)+3-(-1)^A002260(n)-A003057(n)*(-1)^A003056(n))/2;
a(n) = ((t+2)^2-4*j+3-(-1)^i-(t+2)*(-1)^t)/2, where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2).

A213205 T(n,k) = ((k+n)^2-4*k+3+(-1)^k-2*(-1)^n-(k+n)*(-1)^(k+n))/2; n , k > 0, read by antidiagonals.

Original entry on oeis.org

1, 5, 4, 2, 3, 6, 10, 9, 14, 13, 7, 8, 11, 12, 15, 19, 18, 23, 22, 27, 26, 16, 17, 20, 21, 24, 25, 28, 32, 31, 36, 35, 40, 39, 44, 43, 29, 30, 33, 34, 37, 38, 41, 42, 45, 49, 48, 53, 52, 57, 56, 61, 60, 65, 64, 46, 47, 50, 51, 54, 55, 58, 59, 62, 63, 66, 70
Offset: 1

Views

Author

Boris Putievskiy, Feb 15 2013

Keywords

Comments

Permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Enumeration table T(n,k). The order of the list:
T(1,1)=1;
T(1,3), T(2,2), T(2,1), T(1,2), T(3,1);
. . .
T(1,2*n+1), T(2,2*n), T(2,2*n-1), T(1,2*n), ...T(2*n-1,3), T(2*n,2), T(2*n,1), T(2*n-1,2), T(2*n+1,1);
. . .
Movement along two adjacent antidiagonals - step to the southwest, step to the west, step to the northeast, 2 steps to the south, step to the west and so on. The length of each step is 1.
Table contains:
row 1 accommodates elements A130883 in odd places,
row 2 is alternation of elements A100037 and A033816;
column 1 is alternation of elements A000384 and A091823,
column 2 is alternation of elements A014106 and A071355,
column 3 accommodates elements A130861 in even places;
main diagonal is alternation of elements A188135 and A033567,
diagonal 1, located above the main diagonal accommodates elements A033566 in even places,
diagonal 2, located above the main diagonal is alternation of elements A139271 and A024847,
diagonal 3, located above the main diagonal accommodates of elements A033585.

Examples

			The start of the sequence as table:
1....5...2..10...7..19..16...
4....3...9...8..18..17..31...
6...14..11..23..20..36..33...
13..12..22..21..35..34..52...
15..27..24..40..37..57..54...
26..25..39..38..56..55..77...
28..44..41..61..58..82..79...
. . .
The start of the sequence as triangle array read by rows:
1;
5,4;
2,3,6;
10,9,14,13;
7,8,11,12,15;
19,18,23,22,27,26;
16,17,20,21,24,25,28;
. . .
The start of the sequence as array read by rows, the length of row r is 4*r-3.
First 2*r-2 numbers are from the row number 2*r-2 of  triangle array, located above.
Last  2*r-1 numbers are from the row number 2*r-1 of  triangle array, located above.
1;
5,4,2,3,6;
10,9,14,13,7,8,11,12,15;
19,18,23,22,27,26,16,17,20,21,24,25,28;
. . .
Row number r contains permutation 4*r-3 numbers from 2*r*r-5*r+4 to 2*r*r-r:
2*r*r-5*r+7, 2*r*r-5*r+6,...2*r*r-r-4, 2*r*r-r-3, 2*r*r-r.
		

Crossrefs

Programs

  • Maple
    T:=(n,k)->((k+n)^2-4*k+3+(-1)^k-2*(-1)^n-(k+n)*(-1)^(k+n))/2: seq(seq(T(k,n-k),k=1..n-1),n=1..13); # Muniru A Asiru, Dec 06 2018
  • Mathematica
    T[n_, k_] := ((n+k)^2 - 4k + 3 + (-1)^k - 2(-1)^n - (n+k)(-1)^(n+k))/2;
    Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Dec 06 2018 *)
  • Python
    t=int((math.sqrt(8*n-7) - 1)/ 2)
    i=n-t*(t+1)/2
    j=(t*t+3*t+4)/2-n
    result=((t+2)**2-4*j+3+(-1)**j-2*(-1)**i-(t+2)*(-1)**t)/2

Formula

As table
T(n,k) = ((k+n)^2-4*k+3+(-1)^k-2*(-1)^n-(k+n)*(-1)^(k+n))/2.
As linear sequence
a(n) = (A003057(n)^2-4*A004736(n)+3+(-1)^A004736(n)-2*(-1)^A002260(n)-A003057(n)*(-1)^A003056(n))/2;
a(n) = ((t+2)^2-4*j+3+(-1)^j-2*(-1)^i-(t+2)*(-1)^t)/2, where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2).

A216252 A213196 as table read layer by layer clockwise.

Original entry on oeis.org

1, 4, 5, 2, 3, 7, 10, 8, 6, 11, 9, 17, 20, 23, 14, 12, 13, 16, 26, 38, 43, 39, 21, 24, 15, 22, 25, 30, 42, 58, 63, 48, 35, 31, 27, 18, 19, 29, 34, 57, 53, 69, 76, 70, 64, 49, 36, 32, 28, 37, 33, 47, 52, 81, 75, 95, 102, 109, 88, 82, 54, 59, 44, 40, 41, 46, 62
Offset: 1

Views

Author

Boris Putievskiy, Mar 15 2013

Keywords

Comments

Permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Call a "layer" a pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1).
The order of the list:
T(1,1)=1;
T(1,2), T(2,2), T(2,1);
. . .
T(1,n), T(2,n), ... T(n-1,n), T(n,n), T(n,n-1), ... T(n,1);
. . .

Examples

			The start of the sequence as table:
  1....4...3..11..13...
  2....5...7...9..16...
  6....8..10..17..26...
  12..14..23..20..38...
  15..24..21..39..43...
  . . .
The start of the sequence as triangular array read by rows:
  1;
  4,5,2;
  3,7,10,8,6;
  11,9,17,20,23,14,12;
  13,16,26,38,43,39,21,24,15;
  . . .
Row number r contains 2*r-1 numbers.
		

Crossrefs

Programs

  • Python
    t=int((math.sqrt(n-1)))+1
    i=min(t,n-(t-1)**2)
    j=min(t,t**2-n+1)
    m1=(3*i+j-1-(-1)**i+(i+j-2)*(-1)**(i+j))/4
    m2=((1+(-1)**i)*((1+(-1)**j)*2*int((j+2)/4)-(-1+(-1)**j)*(2*int((i+4)/4)+2*int(j/2)))-(-1+(-1)**i)*((1+(-1)**j)*(1+2*int(i/4)+2*int(j/2))-(-1+(-1)**j)*(1+2*int(j/4))))/4
    m=(m1+m2-1)*(m1+m2-2)/2+m1

Formula

a(n) = (m1+m2-1)*(m1+m2-2)/2+m1, where m1=(3*i+j-1-(-1)^i+(i+j-2)*(-1)^(i+j))/4, m2=((1+(-1)^i)*((1+(-1)^j)*2*int((j+2)/4)-(-1+(-1)^j)*(2*int((i+4)/4)+2*int(j/2)))-(-1+(-1)^i)*((1+(-1)^j)*(1+2*int(i/4)+2*int(j/2))-(-1+(-1)^j)*(1+2*int(j/4))))/4, i=min(t; n-(t-1)^2), j=min(t; t^2-n+1), t=floor(sqrt(n-1))+1.

A216253 A213196 as table read layer by layer - layer clockwise, layer counterclockwise and so on.

Original entry on oeis.org

1, 2, 5, 4, 3, 7, 10, 8, 6, 12, 14, 23, 20, 17, 9, 11, 13, 16, 26, 38, 43, 39, 21, 24, 15, 18, 27, 31, 35, 48, 63, 58, 42, 30, 25, 22, 19, 29, 34, 57, 53, 69, 76, 70, 64, 49, 36, 32, 28, 40, 44, 59, 54, 82, 88, 109, 102, 95, 75, 81, 52, 47, 33, 37, 41, 46, 62
Offset: 1

Views

Author

Boris Putievskiy, Mar 15 2013

Keywords

Comments

Permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Call a "layer" a pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1). Table read by boustrophedonic ("ox-plowing") method.
Let m be natural number. The order of the list:
T(1,1)=1;
T(2,1), T(2,2), T(1,2);
. . .
T(1,2*m+1), T(2,2*m+1), ... T(2*m,2*m+1), T(2*m+1,2*m+1), T(2*m+1,2*m), ... T(2*m+1,1);
T(2*m,1), T(2*m,2), ... T(2*m,2*m-1), T(2*m,2*m), T(2*m-1,2*m), ... T(1,2*m);
. . .
The first row is layer read clockwise, the second row is layer counterclockwise.

Examples

			The start of the sequence as table:
  1....4...3..11..13...
  2....5...7...9..16...
  6....8..10..17..26...
  12..14..23..20..38...
  15..24..21..39..43...
  . . .
The start of the sequence as triangular array read by rows:
  1;
  2,5,4;
  3,7,10,8,6;
  12,14,23,20,17,9,11;
  13,16,26,38,43,39,21,24,15;
  . . .
Row number r contains 2*r-1 numbers.
		

Crossrefs

Programs

  • Python
    t=int((math.sqrt(n-1)))+1
    i=(t % 2)*min(t,n-(t-1)**2) + ((t+1) % 2)*min(t,t**2-n+1)
    j=(t % 2)*min(t,t**2-n+1) + ((t+1) % 2)*min(t,n-(t-1)**2)
    m1=(3*i+j-1-(-1)**i+(i+j-2)*(-1)**(i+j))/4
    m2=((1+(-1)**i)*((1+(-1)**j)*2*int((j+2)/4)-(-1+(-1)**j)*(2*int((i+4)/4)+2*int(j/2)))-(-1+(-1)**i)*((1+(-1)**j)*(1+2*int(i/4)+2*int(j/2))-(-1+(-1)**j)*(1+2*int(j/4))))/4
    m=(m1+m2-1)*(m1+m2-2)/2+m1

Formula

a(n) = (m1+m2-1)*(m1+m2-2)/2+m1, where m1=(3*i+j-1-(-1)^i+(i+j-2)*(-1)^(i+j))/4, m2=((1+(-1)^i)*((1+(-1)^j)*2*int((j+2)/4)-(-1+(-1)^j)*(2*int((i+4)/4)+2*int(j/2)))-(-1+(-1)^i)*((1+(-1)^j)*(1+2*int(i/4)+2*int(j/2))-(-1+(-1)^j)*(1+2*int(j/4))))/4, i=(t mod 2)*min(t; n-(t-1)^2) + (t+1 mod 2)*min(t; t^2-n+1), j=(t mod 2)*min(t; t^2-n+1) + (t+1 mod 2)*min(t; n-(t-1)^2), t=floor(sqrt(n-1))+1.
Showing 1-7 of 7 results.