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.

A210535 Second inverse function (numbers of columns) for pairing function A209293.

Original entry on oeis.org

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

Views

Author

Boris Putievskiy, Jan 28 2013

Keywords

Examples

			The start of the sequence as triangle array read by rows:
  1;
  2,1;
  2,3,1;
  2,4,3,1;
  2,4,5,3,1;
  2,4,6,5,3,1;
  2,4,6,7,5,3,1;
  2,4,6,8,7,5,3,1;
  . . .
Row number r contains permutation numbers from 1 to r: 2,4,6,...2*floor(r/2),2*floor(r/2)-1,2*floor(r/2)-3,...3,1.
		

Crossrefs

Programs

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

Formula

a(n) = 2*A200260(n)-A101688(n)*(4*A002260(n)-2*A003056(n)-3).
a(n) = 2*i-v*(4*i-2*t-3), where t = floor((-1+sqrt(8*n-7))/2), i = n-t*(t+1)/2, v = floor((2*n+1-t*(t+1))/(t+3)).

A214928 A209293 as table read layer by layer clockwise.

Original entry on oeis.org

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

Views

Author

Boris Putievskiy, Mar 11 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.
Layer is 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....2...5...8..13..18...
  3....4...9..12..19..24...
  6....7..14..17..26..31...
  10..11..20..23..34..39...
  15..16..27..30..43..48...
  21..22..35..38..53..58...
  . . .
The start of the sequence as triangle array read by rows:
  1;
  2,4,3;
  5,9,14,7,6;
  8,12,17,23,20,11,10;
  13,19,26,34,43,30,27,16,15;
  18,24,31,39,48,58,53,38,35,22,21;
  . . .
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=int((i+j)/2)+int(i/2)*(-1)**(2*i+j-1)
    m2=int((i+j+1)/2)+int(i/2)*(-1)**(2*i+j-2)
    result=(m1+m2-1)*(m1+m2-2)/2+m1

Formula

As table
T(n,k) = n*n/2+4*(floor((k-1)/2)+1)*n+ceiling((k-1)^2/2), n,k > 0.
As linear sequence
a(n)= (m1+m2-1)*(m1+m2-2)/2+m1, where m1=floor((i+j)/2) + floor(i/2)*(-1)^(2*i+j-1), m2=int((i+j+1)/2)+int(i/2)*(-1)^(2*i+j-2), where i=min(t; n-(t-1)^2), j=min(t; t^2-n+1), t=floor(sqrt(n-1))+1.

A214929 A209293 as table read layer by layer - layer clockwise, layer counterclockwise and so on.

Original entry on oeis.org

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

Views

Author

Boris Putievskiy, Mar 11 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.
Layer is 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....2...5...8..13..18...
  3....4...9..12..19..24...
  6....7..14..17..26..31...
  10..11..20..23..34..39...
  15..16..27..30..43..48...
  21..22..35..38..53..58...
  . . .
The start of the sequence as triangle array read by rows:
  1;
  3,4,2;
  5,9,14,7,6;
  10,11,20,23,17,12,8;
  13,19,26,34,43,30,27,16,15;
  21,22,35,38,53,58,48,39,31,24,18;
  . . .
Row number r contains 2*r-1 numbers.
		

Crossrefs

Cf. A081344, A209293, A209279, A209278, A185180; table T(n,k) contains: in rows A000982, A097063; in columns A000217, A000124, A000096, A152948, A034856, A152950, A055998, A000982, A097063.

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=int((i+j)/2)+int(i/2)*(-1)**(2*i+j-1)
    m2=int((i+j+1)/2)+int(i/2)*(-1)**(2*i+j-2)
    result=(m1+m2-1)*(m1+m2-2)/2+m1

Formula

As table
T(n,k) = n*n/2+4*(floor((k-1)/2)+1)*n+ceiling((k-1)^2/2), n,k > 0.
As linear sequence
a(n)= (m1+m2-1)*(m1+m2-2)/2+m1, where
m1=floor((i+j)/2) + floor(i/2)*(-1)^(2*i+j-1), m2=int((i+j+1)/2)+int(i/2)*(-1)^(2*i+j-2),
where 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.

A220073 Mirror of the triangle A130517.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Dec 03 2012

Keywords

Comments

T(n,k) = A130517(n,n-k+1), 1 <= k <= n;
T(n,n) = T(n,1) + 1.
From Boris Putievskiy, Jan 15 2013: (Start)
General case see A187760. Let m be natural number. Table T(n,k) n, k > 0, T(n,k)=n-k+1, if n>=k, T(n,k)=k-n+m-1, if n < k. Table T(n,k) read by antidiagonals. The first column of the table T(n,1) is the sequence of the natural numbers A000027. In all columns with number k (k > 1) the segment with the length of (k-1): {m+k-2, m+k-3, ..., m} shifts the sequence A000027. For m=1 the result is A220073, for m=2 the result is A143182. (End)
First inverse function (numbers of rows) for pairing function A209293. - Boris Putievskiy, Jan 28 2013

Examples

			From _Boris Putievskiy_, Jan 15 2013: (Start)
The start of the sequence as table:
1..1..2..3..4..5..6..7...
2..1..1..2..3..4..5..6...
3..2..1..1..2..3..4..5...
4..3..2..1..1..2..3..4...
5..4..3..2..1..1..2..3...
6..5..4..3..2..1..1..2...
7..6..5..4..3..2..1..1...
8..7..6..5..4..3..2..1...
. . .
The start of the sequence as triangle array read by rows:
1,
1, 2,
2, 1, 3,
3, 1, 2, 4,
4, 2, 1, 3, 5,
5, 3, 1, 2, 4, 6,
6, 4, 2, 1, 3, 5, 7,
7, 5, 3, 1, 2, 4, 6, 8,
. . .
Row number r contains r numbers: r-1, r-3,...,1,...r-2,r.
(End)
		

Crossrefs

Cf. A028310 (left edge), A000027 (right edge), A000012 (central terms), A000217 (row sums), A220075 (partial sums in rows), A002260, A000027, A143182, A187760, A209293.

Programs

  • Haskell
    a220073 n k = a220073_tabl !! (n-1) !! (k-1)
    a220073_row n = a220073_tabl !! (n-1)
    a220073_tabl = map reverse a130517_tabl
  • Mathematica
    max = 13;
    row[n_] := Join[Range[n, 1, -1], Range[max - n + 1]];
    T = Array[row, max];
    Table[T[[n - k + 1, k]], {n, 1, max}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Sep 11 2017 *)

Formula

T(1,1)=1, for n>1: T(n,k)=T(n-1,n-k+1), 1<=k
From Boris Putievskiy, Jan 15 2013: (Start)
For the general case
a(n) = |(t+1)^2 - 2n| + m*floor((t^2+3t+2-2n)/(t+1)),
where t = floor((-1+sqrt(8*n-7))/2).
For m = 2
a(n) = |(t+1)^2 - 2n| + floor((t^2+3t+2-2n)/(t+1)),
where t=floor((-1+sqrt(8*n-7))/2). (End)
Showing 1-4 of 4 results.