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 13 results. Next

A064788 Inverse permutation to A060736.

Original entry on oeis.org

1, 2, 5, 3, 4, 8, 13, 9, 6, 7, 12, 18, 25, 19, 14, 10, 11, 17, 24, 32, 41, 33, 26, 20, 15, 16, 23, 31, 40, 50, 61, 51, 42, 34, 27, 21, 22, 30, 39, 49, 60, 72, 85, 73, 62, 52, 43, 35, 28, 29, 38, 48, 59, 71, 84, 98, 113, 99, 86, 74, 63, 53, 44, 36, 37, 47, 58, 70, 83, 97, 112
Offset: 1

Views

Author

N. J. A. Sloane, Oct 20 2001

Keywords

Crossrefs

Programs

Formula

a(n) = (i+j-1)*(i+j-2)/2+j, where i=min(t; t^2-n+1), j=min(t; n-(t-1)^2), t=floor(sqrt(n-1))+1. - Boris Putievskiy, Dec 24 2012

Extensions

More terms from David Wasserman, Jan 15 2002

A061349 Sum of antidiagonals of A060736.

Original entry on oeis.org

0, 1, 6, 17, 40, 75, 130, 203, 304, 429, 590, 781, 1016, 1287, 1610, 1975, 2400, 2873, 3414, 4009, 4680, 5411, 6226, 7107, 8080, 9125, 10270, 11493, 12824, 14239, 15770, 17391, 19136, 20977, 22950, 25025, 27240, 29563, 32034, 34619, 37360, 40221
Offset: 0

Views

Author

Henry Bottomley, Jun 07 2001

Keywords

Comments

a(1) = 1, a(2) = 2+4=6, a(3) = 5+3+9=17, a(4) = 10+6+8+16=40.

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{2,1,-4,1,2,-1},{0,1,6,17,40,75},50] (* Harvey P. Dale, Oct 17 2021 *)
    Accumulate[Table[n^2 + (n - 1)^2 - Floor[((n-1)/2)]*Floor[((n+1)/2)],{n,41}]] (* Stefano Spezia, Jun 05 2023 *)
  • PARI
    concat(0, Vec(x*(x^4+4*x^3+4*x^2+4*x+1)/((x-1)^4*(x+1)^2) + O(x^100))) \\ Colin Barker, Sep 13 2014

Formula

a(n) = A005900(n) - A006918(n).
a(n) = a(n-1) + A001844(n-1) - A002378(A004526(n-1)).
a(n) = a(n-1) + n^2 + (n - 1)^2 - floor((n-1)/2)*floor((n+1)/2).
If n is odd then a(n) = (7*n^3 + 5*n)/12;
If n is even then a(n) = (7*n^3 + 8*n)/12.
From Colin Barker, Sep 13 2014: (Start)
a(n) = (n*(13 + 3*(-1)^n + 14*n^2))/24.
a(n) = 2*a(n-1) + a(n-2) - 4*a(n-3) + a(n-4) + 2*a(n-5) - a(n-6).
G.f.: x*(x^4 + 4*x^3 + 4*x^2 + 4*x + 1)/((x - 1)^4*(x + 1)^2). (End)
E.g.f.: x*((12 + 21*x + 7*x^2)*cosh(x) + (15 + 21*x + 7*x^2)*sinh(x))/12. - Stefano Spezia, Jun 05 2023

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

A220508 T(n,k) = n^2 + k if k <= n, otherwise T(n,k) = k*(k + 2) - n; square array T(n,k) read by ascending antidiagonals (n >= 0, k >= 0).

Original entry on oeis.org

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

Views

Author

Omar E. Pol, Feb 09 2013

Keywords

Comments

This sequence consists of 0 together with a permutation of the natural numbers. The nonnegative integers (A001477) are arranged in the successive layers from T(0,0) = 0. The n-th layer start with T(n,1) = n^2. The n-th layer is formed by the first n+1 elements of row n and the first n elements in increasing order of the column n.
The first antidiagonal is formed by odd numbers: 1, 3. The second antidiagonal is formed by even numbers: 4, 2, 8. The third antidiagonal is formed by odd numbers: 9, 5, 7, 15. And so on.
It appears that in the n-th layer there is at least a prime number <= g and also there is at least a prime number > g, where g is the number on the main diagonal, the n-th oblong number A002378(n), if n >= 1.

Examples

			The second layer is [4, 5, 6, 7, 8] which looks like this:
  .  .  8
  .  .  7,
  4, 5, 6,
Square array T(0,0)..T(10,10) begins:
    0,   3,   8,  15,  24,  35,  48,  63,  80,  99, 120,...
    1,   2,   7,  14,  23,  34,  47,  62,  79,  98, 119,...
    4,   5,   6,  13,  22,  33,  46,  61,  78,  97, 118,...
    9,  10,  11,  12,  21,  32,  45,  60,  77,  96, 117,...
   16,  17,  18,  19,  20,  31,  44,  59,  76,  95, 118,...
   25,  26,  27,  28,  29,  30,  43,  58,  75,  94, 117,...
   36,  37,  38,  39,  40,  41,  42,  57,  74,  93, 114,...
   49,  50,  51,  52,  53,  54,  55,  56,  73,  92, 113,...
   64,  65,  66,  67,  68,  69,  70,  71,  72,  91, 112,...
   81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 111,...
  100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,...
  ...
		

Crossrefs

Column 1 is A000290. Main diagonal is A002378. Column 2 is essentially A002522. Row 1 is A005563. Row 2 gives the absolute terms of A008865.

Formula

From Petros Hadjicostas, Mar 10 2021: (Start)
T(n,k) = (A342354(n,k) - 1)/2.
O.g.f.: (x^4*y^3 + 3*x^3*y^4 + x^4*y^2 - 10*x^3*y^3 - x^2*y^4 + 3*x^3*y^2 + x^2*y^3 - 4*x^3*y + 8*x^2*y^2 + 3*x^2*y + x*y^2 + x^2 - 10*x*y - y^2 + x + 3*y)/((1 - x)^3*(1 - y)^3*(1 - x*y)^2). (End)

Extensions

Name edited by Petros Hadjicostas, Mar 10 2021

A213921 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 clockwise. Table T(n,k) read by antidiagonals.

Original entry on oeis.org

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

Views

Author

Boris Putievskiy, Mar 05 2013

Keywords

Comments

A 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) is 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(2,n), T(4,n), ... T(n,4), T(n,2);
...

Examples

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

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

Formula

As a table:
T(n,k) = n*n - (k mod 2)*n + 2 - floor((k+2)/2), if n>k;
T(n,k) = k*k - ((n mod 2)+1)*k + floor((n+3)/2), if n<=k.
As a linear sequence:
a(n) = i*i - (j mod 2)*i + 2 - floor((j+2)/2), if i>j;
a(n) = j*j - ((i mod 2)+1)*j + floor((i+3)/2), 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).

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

Original entry on oeis.org

1, 3, 4, 8, 2, 9, 15, 6, 7, 16, 24, 13, 5, 14, 25, 35, 22, 11, 12, 23, 36, 48, 33, 20, 10, 21, 34, 49, 63, 46, 31, 18, 19, 32, 47, 64, 80, 61, 44, 29, 17, 30, 45, 62, 81, 99, 78, 59, 42, 27, 28, 43, 60, 79, 100, 120, 97, 76, 57, 40, 26, 41, 58, 77, 98, 121
Offset: 1

Views

Author

Boris Putievskiy, Mar 05 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) is 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(n-1,n), T(n,n-1), ... T(1,n), T(n,1);
...

Examples

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

Crossrefs

Cf. A060734, A060736; table T(n,k) contains: in rows A005563, A028872, A028875, A028881, A028560, A116711; in columns A000290, A008865, A028347, A028878, A028884.

Programs

  • Mathematica
    f[n_, k_] := n^2 - 2*k + 2 /; n >= k; f[n_, k_] := k^2 - 2*n + 1 /; n < k; TableForm[Table[f[n, k], {n, 1, 5}, {k, 1, 10}]]; Table[f[n - k + 1, k], {n, 5}, {k, n, 1, -1}] // Flatten (* G. C. Greubel, Aug 19 2017 *)
  • 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-2*j+2
    else:
       result=j*j-2*i+1

Formula

As a table,
T(n,k) = n*n - 2*k + 2, if n >= k;
T(n,k) = k*k - 2*n + 1, if n < k.
As a linear sequence,
a(n) = i*i - 2*j + 2, if i >= j;
a(n) = j*j - 2*i + 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).

A194195 First inverse function (numbers of rows) for pairing function A060734.

Original entry on oeis.org

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

Views

Author

Boris Putievskiy, Dec 21 2012

Keywords

Comments

The sequence is the second inverse function (numbers of columns) for pairing function A060736.

Examples

			The start of the sequence as triangle array read by rows:
1;
2,2,1;
3,3,3,2,1;
4,4,4,4,3,2,1;
. . .
Row number k contains 2k-1 numbers k,k,...k,k-1,k-2,...1 (k times repetition "k").
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=Module[{t=Floor[Sqrt[n-1]]+1},Min[t,t^2-n+1]]; Array[f,80] (* Harvey P. Dale, Dec 31 2012 *)
  • Python
    t=int(math.sqrt(n-1)) +1
    i=min(t,t**2-n+1)

Formula

a(n) = min{t; t^2 - n + 1}, where t=floor(sqrt(n-1))+1.

A194258 Second inverse function (numbers of columns) for pairing function A060734.

Original entry on oeis.org

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

Views

Author

Boris Putievskiy, Dec 21 2012

Keywords

Comments

The sequence is the first inverse function (numbers of rows) for pairing function A060736.

Examples

			The start of the sequence as triangle array read by rows:
1;
1,2,2;
1,2,3,3,3;
1,2,3,4,4,4,4;
. . .
Row number k contains 2k-1 numbers 1,2,...k-1,k,k,...k (k times repetition "k").
		

Crossrefs

Programs

  • Mathematica
    Flatten[Table[Join[Range[n-1],Table[n,{n}]],{n,10}]] (* Harvey P. Dale, Jun 23 2013 *)
  • Python
    t=int(math.sqrt(n-1)) +1
    j=min(t,n-(t-1)**2)

Formula

a(n) = min{t; n - (t - 1)^2}, where t=floor(sqrt(n-1))+1.

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.

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

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

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
    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).
Showing 1-10 of 13 results. Next