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.

A081344 Natural numbers in square maze arrangement, read by antidiagonals.

Original entry on oeis.org

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

Views

Author

Paul Barry, Mar 19 2003

Keywords

Comments

Arrange the natural numbers by taking clockwise and counterclockwise turns. Begin (LL) and then repeat (RRR)(LLL).
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, Dec 16 2012
For generalizations see A219159, A213928. - Boris Putievskiy, Mar 10 2013

Examples

			The start of the sequence as table T(i,j), i,j > 0:
   1   4    5    16 ...
   2   3    6    15 ...
   9   8    7    14 ...
  10  11   12    13 ...
  ....
		

Crossrefs

Cf. A219159, A213928. The main diagonal is A002061. The following appear within interlaced sequences: A016754, A001844, A053755, A004120. The first row is A081345. The first column is A081346. The inverse permutation A194280, the first inverse function (numbers of rows) A220603, the second inverse function (numbers of columns) A220604.

Programs

  • Mathematica
    T[n_, k_] := T[n, k] = Which[OddQ[n] && k==1, n^2, EvenQ[k] && n==1, k^2, EvenQ[n] && k==1, T[n-1, 1]+1, OddQ[k] && n==1, T[1, k-1]+1, k <= n, T[n, k-1]+1 - 2 Mod[n, 2], True, T[n-1, k]-1 + 2 Mod[k, 2]]; Table[T[n-k+1, k], {n, 1, 12}, {k, 1, n}] // Flatten (* Jean-François Alcover, Feb 20 2019 *)
  • 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 j >= i:
         m=(j-1)**2 + j + (j-i)*(-1)**(j-1)
    else:
         m=(i-1)**2 + i - (i-j)*(-1)**(i-1)
    # Boris Putievskiy, Dec 19 2012
    
  • Python
    from math import isqrt
    def A081344(n):
        t = (k:=isqrt(m:=n<<1))+((m<<2)>(k<<2)*(k+1)+1)-1
        i, j = n-(t*(t+1)>>1), (t*(t+3)>>1)+2-n
        r = max(i,j)
        return (r-1)**2+r+(j-i if r&1 else i-j) # Chai Wah Wu, Nov 04 2024

Formula

From Boris Putievskiy, Dec 19 2012: (Start)
a(n) = (i-1)^2 + i + (i-j)*(-1)^(i-1) if i >= j,
a(n) = (j-1)^2 + j - (j-i)*(-1)^(j-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). (End)
Enumeration by boustrophedonic ("ox-plowing") method: If i >= j: T(i,j)=(i-1)^2+i + (i-j)*(-1)^(i-1), if i < j: T(i,j)=(j-1)^2+j - (j-i)*(-1)^(j-1). - Boris Putievskiy, Dec 19 2012
T(i,j) = m^2 - m + 1 - (i - j)*(-1)^m where m = max(i,j). - Ziad Ahmed, Jun 09 2025

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.

A363376 Determinant of the n X n matrix formed by placing 1..n^2 in L-shaped gnomons in alternating directions.

Original entry on oeis.org

1, -5, 78, -1200, 19680, -351360, 6854400, -145797120, 3367526400, -84072038400, 2258332876800, -64990937088000, 1995834890649600, -65167516237824000, 2254974602969088000, -82443156980760576000, 3176032637949050880000, -128603097714237898752000, 5460911310769351557120000
Offset: 1

Views

Author

Nicolay Avilov, May 29 2023

Keywords

Comments

The matrix is the upper-left n X n part of the square arrangement in A081344.
Number i is in the matrix at row A220604(i) column A220603(i), for i = 1..n^2.
Conjecture: a(n) has trailing zeros for n > 3. - Stefano Spezia, May 31 2023
The conjecture is true and its proof follows easily from Detlef Meya's formula. - Stefano Spezia, Apr 20 2024

Examples

			         |  1----2    9---10   25 |
         |       |    |    |    | |
         |  4----3    8   11   24 |
         |  |         |    |    | |
  a(5) = |  5----6----7   12   23 | = 19680.
         |                 |    | |
         | 16---15---14---13   22 |
         |  |                   | |
         | 17---18---19---20---21 |
		

Crossrefs

Cf. A081344, A220603, A220604, A363460 (permanent).

Programs

  • Mathematica
    a={}; For[n=1, n<=19, n++,k=i=j=1; M[i,j]=k++; For[h=1, hStefano Spezia, May 31 2023 *)
    a={1};For[n=2,n<20,n++,AppendTo[a,(-1)^(n-1)*2^(n-3)*(2*n*(n-1)+1)*n!]];a (* Detlef Meya, Jun 11 2023 *)

Formula

a(1) = 1, for a > 1: a(n) = (-1)^(n-1)*2^(n-3)*(2*n*(n-1)+1)*(n!). - Detlef Meya, Jun 11 2023
E.g.f.: x*(2 + 7*x + 20*x^2 + 12*x^3)/(2*(1 + 2*x)^3). - Stefano Spezia, Apr 20 2024

Extensions

a(16)-a(19) from Stefano Spezia, May 31 2023

A363460 a(n) is the permanent of the n X n matrix formed by placing 1..n^2 in L-shaped gnomons in alternating directions.

Original entry on oeis.org

1, 1, 11, 556, 74964, 21700112, 11500685084, 10057140949968, 13496937368200000, 26331147893897760544, 71606290155732170272320, 262516365211410942628577408, 1262517559940020030446967822592, 7786463232979127181938238723356160, 60414239829783205320232261233394491136
Offset: 0

Views

Author

Stefano Spezia, Jun 03 2023

Keywords

Comments

The matrix is the upper-left n X n part of the square arrangement in A081344.
The matrix element k is at row A220604(k) and column A220603(k), for k = 1..n^2.

Examples

			a(5) = 21700112 is the permanent of the 5 X 5 matrix
  |  1----2    9---10   25 |
  |       |    |    |    | |
  |  4----3    8   11   24 |
  |  |         |    |    | |
  |  5----6----7   12   23 |
  |                 |    | |
  | 16---15---14---13   22 |
  |  |                   | |
  | 17---18---19---20---21 |
		

Crossrefs

Cf. A006527 (trace), A037270 (elements sum of the matrix), A060736, A061349 (anti trace), A081344, A220603, A220604, A363376 (determinant).

Programs

  • Mathematica
    a={1}; For[n=1, n<=14, n++,k=i=j=1; M[i,j]=k++; For[h=1, h
    				
Showing 1-5 of 5 results.