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

A064790 Inverse permutation to A060734.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Oct 20 2001

Keywords

Comments

From Boris Putievskiy, Mar 14 2013: (Start)
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). This sequence is A188568 as table read by boustrophedonic ("ox-plowing") method - layer clockwise, layer counterclockwise and so. The same table A188568 read layer by layer clockwise is A194280. (End)

Examples

			From _Boris Putievskiy_, Mar 14 2013: (Start)
The start of the sequence as table:
  1....2...6...7..15..16..28...
  3....5...9..12..20..23..35...
  4....8..13..18..26..31..43...
  10..14..19..25..33..40..52...
  11..17..24..32..41..50..62...
  21..27..34..42..51..61..73...
  22..30..39..49..60..72..85...
  ...
The start of the sequence as triangular array read by rows:
  1;
  3,5,2;
  6,9,13,8,4;
  10,14,19,25,18,12,7;
  15,20,26,33,41,32,24,17,11;
  21,27,34,42,51,61,50,40,31,23,16;
  28,35,43,52,62,73,85,72,60,49,39,30,22;
  ...
Row number r contains 2*r-1 numbers. (End)
		

Crossrefs

Formula

a(n) = (i+j-1)*(i+j-2)/2+i, 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

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.

A060736 Array of square numbers read by antidiagonals in up direction.

Original entry on oeis.org

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

Views

Author

Frank Ellermann, Apr 23 2001

Keywords

Comments

A simple permutation of 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. - Boris Putievskiy, Jan 09 2013

Examples

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

Crossrefs

Cf. A060734. Inverse permutation: A064788, the first inverse function (numbers of rows) A194258, the second inverse function (numbers of columns) A194195.

Programs

  • Mathematica
    Table[ If[n < 2*k-1, k^2 + k - n, (n-k)^2 + k], {n, 1, 10}, {k, 1, n}] // Flatten (* Jean-François Alcover, Jan 09 2013 *)
  • 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**2-j+1
    else:
       result=(j-1)**2+i
    # Boris Putievskiy, Jan 09 2013

Formula

T(n+1, k)=n*n+k, T(k, n+1)=(n+1)*(n+1)+1-k, 1 <= k <= n+1.
a(n)=i^2-j+1 if i >= j, a(n)=(j-1)^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). - Boris Putievskiy, Jan 09 2013

A326407 Minesweeper sequence of positive integers arranged on a 2D grid along a square array that grows by alternately adding a row at its bottom edge and a column at its right edge.

Original entry on oeis.org

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

Views

Author

Witold Tatkiewicz, Oct 02 2019

Keywords

Comments

Place positive integers on a 2D grid starting with 1 in the top left corner and continue along an increasing square array as in A060734.
Replace each prime with -1 and each nonprime with the number of primes in adjacent grid cells around them.
n is replaced by a(n).
This sequence treats prime numbers as "mines" and fills gaps according to the rules of the classic Minesweeper game.
a(n) < 6 (conjectured).
a(n) = 5 for n={6} (conjectured).
Set of n such that a(n) = 4 is unbounded (conjectured).

Examples

			Consider positive integers distributed onto the plane along an increasing square array:
   1  4  9 16 25 36
   2  3  8 15 24 35
   5  6  7 14 23 34
  10 11 12 13 22 33
  17 18 19 20 21 32
  26 27 28 29 30 31
...
1 is not prime and in adjacent grid cells there are 2 primes: 2 and 3. Therefore a(1) = 2.
2 is prime, therefore a(2) = -1.
8 is not prime and in adjacent grid cells there are 2 primes: 3, and 7. Therefore a(8) = 2.
Replacing n with a(n) in the plane described above, and using "." for a(n) = 0 and "*" for negative a(n), we produce a graph resembling Minesweeper, where the mines are situated at prime n:
  2  2  1  .  .  .  .  .  .  .  .  . ...
  *  *  2  2  1  2  1  2  1  1  .  1
  *  5  *  3  *  2  *  3  *  2  1  1
  3  *  4  *  2  2  2  *  3  *  1  1
  *  3  *  3  3  1  3  2  3  1  2  1
  2  3  2  *  3  *  3  *  1  .  1  *
  *  1  2  3  *  3  *  2  1  .  2  3
  1  2  2  *  2  3  2  3  1  2  2  *
  1  2  *  2  1  1  *  3  *  2  *  2
  2  *  3  2  .  2  3  *  3  3  1  1
  *  3  *  1  1  2  *  3  *  2  1  .
  1  2  1  2  2  *  3  3  2  *  1  1
...
In order to produce the sequence, the graph is read along the original mapping.
		

Crossrefs

Cf. A060734 - plane mapping
Different arrangements of integers:
Cf. A326405 - antidiagonals,
Cf. A326406 - triangle maze,
Cf. A326408 - square maze,
Cf. A326409 - Hamiltonian path,
Cf. A326410 - Ulam's spiral.

Programs

A185725 Array associated with squares, by antidiagonals.

Original entry on oeis.org

1, 2, 3, 5, 4, 6, 10, 7, 8, 11, 17, 12, 9, 13, 18, 26, 19, 14, 15, 20, 27, 37, 28, 21, 16, 22, 29, 38, 50, 39, 30, 23, 24, 31, 40, 51, 65, 52, 41, 32, 25, 33, 42, 53, 66, 82, 67, 54, 43, 34, 35, 44, 55, 68, 83, 101, 84, 69, 56, 45, 36, 46, 57, 70, 85, 102, 122, 103, 86, 71, 58, 47, 48, 59, 72, 87, 104, 123, 145, 124, 105, 88, 73, 60, 49, 61, 74, 89, 106, 125, 146, 170, 147, 126, 107, 90, 75, 62, 63, 76, 91, 108, 127, 148, 171
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.

Examples

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

Crossrefs

Programs

  • Mathematica
    f[n_,k_]:=(k-1)^2+2*n-1/; n<=k;
    f[n_,k_]:=(n-1)^2+2*k/; n>k;
    TableForm[Table[f[n,k],{n,1,10},{k,1,15}]]
    Table[f[n-k+1,k],{n,14},{k,n,1,-1}]//Flatten

Formula

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

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

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

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

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

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