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

A060734 Natural numbers written as a square array ending in last row from left to right and rightmost column from bottom to top are read by antidiagonals downwards.

Original entry on oeis.org

1, 4, 2, 9, 3, 5, 16, 8, 6, 10, 25, 15, 7, 11, 17, 36, 24, 14, 12, 18, 26, 49, 35, 23, 13, 19, 27, 37, 64, 48, 34, 22, 20, 28, 38, 50, 81, 63, 47, 33, 21, 29, 39, 51, 65, 100, 80, 62, 46, 32, 30, 40, 52, 66, 82, 121, 99, 79, 61, 45, 31, 41, 53, 67, 83, 101
Offset: 1

Views

Author

Frank Ellermann, Apr 23 2001

Keywords

Comments

A simple permutation of natural numbers.
Parity of the sequence is given by A057211 (n-th run has length n). - Jeremy Gardiner, Dec 26 2008
The square with corners T(1,1)=1 and T(n,n)=n^2-n+1 is occupied by the numbers 1,2,...,n^2. - Clark Kimberling, Feb 01 2011
a(n) is pairing function - function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} - the set of integer positive numbers. - Boris Putievskiy, Dec 17 2012

Examples

			Northwest corner:
.1  4  9 16 ..  => a(1) =  1
.2  3  8 15 ..  => a(2) =  4, a(3) = 2
.5  6  7 14 ..  => a(4) =  9, a(5) = 3, a(6) = 5
10 11 12 13 ..  => a(7) = 16, a(8) = 8, a(9) = 6, a(10)=10
		

Crossrefs

Cf. A060736. Inverse: A064790.

Programs

  • Maple
    T:= (n,k)-> `if`(n<=k, k^2-n+1, (n-1)^2+k):
    seq(seq(T(n, d-n), n=1..d-1), d=2..15);
  • Mathematica
    f[n_, k_]:=k^2-n+1/; k>=n;
    f[n_, k_]:=(n-1)^2+k/; kClark Kimberling, Feb 01 2011 *)

Formula

T(n,k) = (n-1)^2+k, T(k, n)=n^2+1-k, 1 <= k <= n.
From Clark Kimberling, Feb 01 2011: (Start)
T(1,k) = k^2 (A000290).
T(n,n) = n^2-n+1 (A002061).
T(n,1) = (n-1)^2+1 (A002522). (End)

Extensions

Corrected by Jeremy Gardiner, Dec 26 2008

A185728 Array associated with squares, by antidiagonals.

Original entry on oeis.org

1, 2, 3, 5, 4, 8, 10, 6, 7, 15, 17, 11, 9, 14, 24, 26, 18, 12, 13, 23, 35, 37, 27, 19, 16, 22, 34, 48, 50, 38, 28, 20, 21, 33, 47, 63, 65, 51, 39, 29, 25, 32, 46, 62, 80, 82, 66, 52, 40, 30, 31, 45, 61, 79, 99, 101, 83, 67, 53, 41, 36, 44, 60, 78, 98, 120, 122, 102, 84, 68, 54, 42, 43, 59, 77, 97, 119, 143, 145, 123, 103, 85, 69, 55, 49, 58, 76, 96, 118, 142, 168, 170, 146, 124, 104, 86, 70, 56, 57, 75, 95, 117, 141, 167, 195
Offset: 1

Views

Author

Clark Kimberling, Feb 01 2011

Keywords

Comments

Every positive integer occurs exactly once; hence, as a sequence, A185725 is a permutation of the positive integers. The square with corners T(0,0)=1 and T(n,n)=n^2 is occupied by the numbers 1,2,...,n^2.
T(1,k)=(k-1)^2+1 (A002522)
T(n,1)=-1+n^2 for n>=2.

Examples

			Northwest corner:
1...2...5...10...17
3...4...6...11...18
8...7...9...12...19
15..14..13..16...20
		

Crossrefs

Programs

  • Mathematica
    f[n_,k_]:=(k-1)^2+n/; k>n;
    f[n_,n_]:=n^2; f[n_,k_]:=n^2-k/; k
    				

Formula

T(n,k)=(k-1)^2+n if nk.

A185726 Array associated with squares, by antidiagonals.

Original entry on oeis.org

1, 3, 4, 8, 10, 10, 18, 22, 24, 21, 35, 44, 45, 48, 39, 61, 80, 81, 84, 86, 66, 98, 134, 138, 136, 144, 142, 104, 148, 210, 222, 216, 220, 231, 220, 155, 213, 312, 339, 332, 325, 340, 351, 324, 221, 295, 444, 495, 492, 475, 480, 504, 510, 458, 304, 396, 610, 696, 704, 680, 666, 690, 720, 714, 626, 406, 518, 814, 948, 976, 950, 918, 924, 965, 996, 969, 832, 529, 663, 1060, 1257, 1316, 1295, 1248, 1225, 1260, 1315, 1340, 1281, 1080, 675, 833, 1352, 1629, 1732, 1725
Offset: 1

Views

Author

Clark Kimberling, Feb 01 2011

Keywords

Comments

Every positive integer occurs exactly once; hence, as a sequence, A185725 is a permutation of the positive integers. The square with corners T(0,0)=1 and T(n,n)=n^2 is occupied by the numbers 1,2,...,n^2.
T(n,1)=n^2 (A000290)
T(n,n)=(n-1)^2+1 (A002522)
T(1,k)=k^2-1 (A132411).

Examples

			Northwest corner:
1...3...8...15...24
4...2...6...13...22
9...7...5...11...20
16..14..12..10...18
		

Crossrefs

Programs

  • Mathematica
    f[n_,k_]:=n^2-2*k+2/; n>=k;
    f[n_,k_]:=k^2-2*n+1/; n
    				

Formula

T(n,k)=n^2-2k+2 if n>=k; T(n,k)=k^2-2n+1 if n

A214870 Natural numbers placed in table T(n,k) layer by layer. The order of placement: at the beginning filled odd places of layer clockwise, next - even places counterclockwise. T(n,k) read by antidiagonals.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 10, 9, 8, 13, 17, 16, 6, 14, 21, 26, 25, 11, 12, 22, 31, 37, 36, 18, 15, 20, 32, 43, 50, 49, 27, 24, 23, 30, 44, 57, 65, 64, 38, 35, 19, 33, 42, 58, 73, 82, 81, 51, 48, 28, 29, 45, 56, 74, 91, 101, 100, 66, 63, 39, 34, 41, 59, 72, 92, 111
Offset: 1

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).
Enumeration table T(n,k) layer by layer. The order of the list:
T(1,1)=1;
T(1,2), T(2,1), T(2,2);
. . .
T(1,n), T(3,n), ... T(n,3), T(n,1); T(n,2), T(n,4), ... T(4,n), T(2,n);
. . .

Examples

			The start of the sequence as table:
   1   2   5  10  17  26 ...
   3   4   9  16  25  36 ...
   7   8   6  11  18  27 ...
  13  14  12  15  24  35 ...
  21  22  20  23  19  28 ...
  31  32  30  33  29  34 ...
  ...
The start of the sequence as triangle array read by rows:
   1;
   2,  3;
   5,  4,  7;
  10,  9,  8, 13;
  17, 16,  6, 14, 21;
  26, 25, 11, 12, 22, 31;
  ...
		

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
    if i > j:
       result=i*i-i+(j%2)*(2-(j+1)/2)+((j+1)%2)*(j/2+1)
    else:
       result=j*j-2*(i%2)*j + (i%2)*((i+1)/2+1) + ((i+1)%2)*(-i/2+1)

Formula

As table
T(n,k) = k*k-2*(n mod 2)*k+(n mod 2)*((n+1)/2+1)+((n+1) mod 2)*(-n/2+1), if n<=k;
T(n,k) = n*n-n+(k mod 2)*(2-(k+1)/2)+((k+1) mod 2)*(k/2+1), if n>k.
As linear sequence
a(n) = j*j-2*(i mod 2)*j+(i mod 2)*((i+1)/2+1)+((i+1) mod 2)*(-i/2+1), if i<=j;
a(n) = i*i-i+(j mod 2)*(2-(j+1)/2)+((j+1) mod 2)*(j/2+1), if i>j; where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2).

A214871 Natural numbers placed in table T(n,k) layer by layer. The order of placement - T(n,n), T(1,n), T(n,1), T(2,n), T(n,2),...T(n-1,n), T(n,n-1). Table T(n,k) read by antidiagonals.

Original entry on oeis.org

1, 3, 4, 6, 2, 7, 11, 8, 9, 12, 18, 13, 5, 14, 19, 27, 20, 15, 16, 21, 28, 38, 29, 22, 10, 23, 30, 39, 51, 40, 31, 24, 25, 32, 41, 52, 66, 53, 42, 33, 17, 34, 43, 54, 67, 83, 68, 55, 44, 35, 36, 45, 56, 69, 84, 102, 85, 70, 57, 46, 26, 47, 58, 71, 86, 103, 123
Offset: 1

Author

Boris Putievskiy, Mar 11 2013

Keywords

Comments

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).
Enumeration table T(n,k) layer by layer. The order of the list:
T(1,1)=1;
T(2,2), T(1,2), T(2,1);
. . .
T(n,n), T(1,n), T(n,1), T(2,n), T(n,2),...T(n-1,n), T(n,n-1);
. . .

Examples

			The start of the sequence as table:
  1....3...6..11..18..27...
  4....2...8..13..20..29...
  7....9...5..15..22..31...
  12..14..16..10..24..33...
  19..21..23..25..17..35...
  28..30..32..34..36..26...
  . . .
The start of the sequence as triangle array read by rows:
  1;
  3,4;
  6,2,7;
  11,8,9,12;
  18,13,5,14,19;
  27,20,15,16,21,28;
  . . .
		

Crossrefs

Cf. A060734, A060736, A185725, A213921, A213922; table T(n,k) contains: in rows A059100, A087475, A114949, A189833, A114948, A114962; in columns A117950, A117951, A117619, A189834, A189836; the main diagonal is A002522.

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
    if i == j:
       result=(i-1)**2+1
    if i > j:
       result=(i-1)**2+2*j+1
    if i < j:
       result=(j-1)**2+2*i

Formula

As table
T(n,k) = (n-1)^2+1, if n=k;
T(n,k) = (n-1)^2+2*k+1, if n>k;
T(n,k) = (k-1)^2+2*n, if n
As linear sequence
a(n) = (i-1)^2+1, if i=j;
a(n) = (i-1)^2+2*j+1, if i>j;
a(n) = (j-1)^2+2*i, if i>j; where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2).
Showing 1-5 of 5 results.