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.

A343558 Irregular triangle read by rows: the n-th row gives the row indices of the consecutive elements of the spiral of the n X n matrix defined in A126224.

Original entry on oeis.org

1, 1, 1, 2, 2, 1, 1, 1, 2, 3, 3, 3, 2, 2, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 3, 2, 2, 2, 3, 3, 1, 1, 1, 1, 1, 2, 3, 4, 5, 5, 5, 5, 5, 4, 3, 2, 2, 2, 2, 3, 4, 4, 4, 3, 3, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6, 6, 6, 6, 6, 5, 4, 3, 2, 2, 2, 2, 2, 3, 4, 5, 5, 5, 5, 4, 3, 3, 3, 4, 4
Offset: 1

Views

Author

Stefano Spezia, Apr 19 2021

Keywords

Examples

			The triangle begins
1
1   1   2   2
1   1   1   2   3   3   3   2   2
1   1   1   1   2   3   4   4   4   4   3   2   2   2   3   3
...
		

Crossrefs

Cf. A000290 (row length), A002265, A002411 (row sums), A010873, A060747, A126224, A343559 (column indices).

Programs

  • Mathematica
    a:={};nmax:=6;For[n=1,n<=nmax,n++,For[s=1,s<=2n-1,s++,If[OddQ[s] &&Mod[s,4]==1,k=Ceiling[s/4];For[i=1,i<=Ceiling[n-s/2],i++,AppendTo[a,k]],If[EvenQ[s]&&Mod[s,4]==2,For[i=1,i<=Ceiling[n-s/2],i++,AppendTo[a,k+i]];k+=Ceiling[n-s/2],If[EvenQ[s]&&Mod[s,4]==0,For[i=1,i<=Ceiling[n-s/2],i++,AppendTo[a,k-i]];k=k-i+1,For[i=1,i<=Ceiling[n-s/2],i++,AppendTo[a,k]]]]]]];a

A343559 Irregular triangle read by rows: the n-th row gives the column indices of the consecutive elements of the spiral of the n X n matrix defined in A126224.

Original entry on oeis.org

1, 1, 2, 2, 1, 1, 2, 3, 3, 3, 2, 1, 1, 2, 1, 2, 3, 4, 4, 4, 4, 3, 2, 1, 1, 1, 2, 3, 3, 2, 1, 2, 3, 4, 5, 5, 5, 5, 5, 4, 3, 2, 1, 1, 1, 1, 2, 3, 4, 4, 4, 3, 2, 2, 3, 1, 2, 3, 4, 5, 6, 6, 6, 6, 6, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 2, 3, 4, 5, 5, 5, 5, 4, 3, 2, 2, 2, 3, 4, 4, 3
Offset: 1

Views

Author

Stefano Spezia, Apr 19 2021

Keywords

Examples

			The triangle begins
1
1   2   2   1
1   2   3   3   3   2   1   1   2
1   2   3   4   4   4   4   3   2   1   1   1   2   3   3   2
...
		

Crossrefs

Cf. A000290 (row length), A002265, A002411 (row sums), A010873, A060747, A126224, A343558 (row indices).

Programs

  • Mathematica
    a:={};nmax:=6;For[n=1,n<=nmax,n++,For[s=1,s<=2n-1,s++,If[OddQ[s]&&Mod[s,4]==1 ,k=Floor[s/4];For[i=1,i<=Ceiling[n-s/2],i++,AppendTo[a,k+i]];k=+Floor[s/4]+Ceiling[n-s/2],If[EvenQ[s],For[i=1,i<=Ceiling[n-s/2],i++,AppendTo[a,k]],For[i=1,i<=Ceiling[n-s/2],i++,AppendTo[a,k-i]];k=k-i+1]]]]; a

A343155 Irregular triangle T read by rows: T(n, k) is the sum of the consecutive integers placed along the k-th turn of the spiral of the n X n matrix defined in A126224.

Original entry on oeis.org

1, 10, 36, 9, 78, 58, 136, 164, 25, 210, 318, 138, 300, 520, 356, 49, 406, 770, 654, 250, 528, 1068, 1032, 612, 81, 666, 1414, 1490, 1086, 394, 820, 1808, 2028, 1672, 932, 121, 990, 2250, 2646, 2370, 1614, 570, 1176, 2740, 3344, 3180, 2440, 1316, 169, 1378, 3278, 4122, 4102, 3410, 2238, 778
Offset: 1

Views

Author

Stefano Spezia, Apr 07 2021

Keywords

Examples

			The triangle T(n, k) begins:
n\k|   1    2    3    4
---+-------------------
1  |   1
2  |  10
3  |  36    9
4  |  78   58
5  | 136  164   25
6  | 210  318  138
7  | 300  520  356   49
...
For n = 1 the matrix is
      1
and T(1, 1) = 1.
For n = 2 the matrix is
      1, 2
      4, 3
and T(2, 1) = 1 + 2 + 3 + 4 = 4*5/2 = 10.
For n = 3 the matrix is
      1, 2, 3
      8, 9, 4
      7, 6, 5
and T(3, 1) = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 8*9/2 = 36; T(3, 2) = 9.
For n = 4 the matrix is
      1,  2,  3,  4
     12, 13, 14,  5
     11, 16, 15,  6
     10,  9,  8,  7
and T(4, 1) = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 = 12*13/2 = 78; T(4, 2) = 13 + 14 + 15 + 16 = (13 + 16)*4/2 = 58.
...
		

Crossrefs

Programs

  • Mathematica
    Table[2(2k-n-1)(3+8k(k-n-1)+4n)+n^2KroneckerDelta[n,2k-1],{n,14},{k,Ceiling[n/2]}]//Flatten

Formula

T(n, k) = 2*(2*k - n - 1)*(3 + 8*k*(k - n - 1) + 4*n) + n^2*0^(n+1-2*k) with 0 < k <= ceiling(n/2).
T(n, 1) = A033585(n-1) for n > 1.

A023999 Absolute value of determinant of n X n matrix whose entries are the integers from 1 to n^2 spiraling inward, starting in a corner.

Original entry on oeis.org

1, 5, 48, 660, 11760, 257040, 6652800, 198918720, 6745939200, 255826771200, 10727081164800, 492775291008000, 24610605962342400, 1327677426915840000, 76940526008586240000, 4766815315895592960000, 314406967644177408000000, 21995911456386651463680000
Offset: 1

Views

Author

Charles Diminnie (charles.diminnie(AT)rampo.angelo.edu)

Keywords

Comments

Starting in the NW or SE corner, the signs are cyclic (+,-,-,+), starting in the NE or SW corner, the signs are always positive.

Examples

			n=4: det of
.1..2..3.4
12.13.14.5
11.16.15.6
10..9..8.7
		

Crossrefs

Main diagonal of A226167, A126224 (signed version). - Alois P. Heinz, Jan 21 2014

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, (3*n+1)/4,
          4*(3*n-1)*(2*n-5)*(2*n-3) *a(n-2) /(3*n-7))
        end:
    seq(a(n), n=1..20);  # Alois P. Heinz, Jan 21 2014
  • Mathematica
    M[0, 0] = 1;
    M[i_, j_] := If[i <= j,
      If[i + j >= 0, If[i != j, M[i + 1, j] + 1, M[i, j - 1] + 1],
       M[i, j + 1] + 1],
      If[i + j > 1, M[i, j - 1] + 1, M[i - 1, j] + 1]
      ]
    M[n_] := n^2 + 1 - If[EvenQ[n],
      Table[M[i, j], {j, n/2, -n/2 + 1, -1}, {i, -n/2 + 1, n/2}],
      Table[M[i, j], {j, (n - 1)/2, -(n - 1)/2, -1}, {i, -(n - 1)/2, (n - 1)/2}]]
    a[n_]:=Det[M[n]] (* Christian Krattenthaler, Apr 19 2017 *)
  • Maxima
    A023999(n):=if n=1 then 1 else 2*((-1)^((n+4)*(n-1))/2 *(3*n-1) * (2*n-3)!/(n-2)!)$
    makelist(A023999(n),n,1,30); /* Martin Ettl, Nov 05 2012 */

Formula

a(n) = (3n-1) * (2n-3)!/(n-2)! for n >= 2. [corrected by Robert Israel, Apr 20 2017]
E.g.f.: ((-2*x-1)*sqrt(1-4*x)+1-4*x)/(16*x-4). - Robert Israel, Apr 20 2017

Extensions

Edited and extended by Robert G. Wilson v, May 07 2003

A304487 a(n) = (3 + 2*n - 3*n^2 + 4*n^3 - 3*((-1 + n) mod 2))/6.

Original entry on oeis.org

1, 4, 15, 36, 73, 128, 207, 312, 449, 620, 831, 1084, 1385, 1736, 2143, 2608, 3137, 3732, 4399, 5140, 5961, 6864, 7855, 8936, 10113, 11388, 12767, 14252, 15849, 17560, 19391, 21344, 23425, 25636, 27983, 30468, 33097, 35872, 38799, 41880, 45121, 48524, 52095
Offset: 1

Views

Author

Stefano Spezia, Aug 17 2018

Keywords

Comments

a(n) is the trace of an n X n matrix A in which the entries are 1 through n^2, spiraling inward starting with 1 in the (1,1)-entry (proved).
The first three terms of a(n) coincide with those of A317614.

Examples

			For n = 1 the matrix A is
   1
with trace Tr(A) = a(1) = 1.
For n = 2 the matrix A is
   1, 2
   4, 3
with Tr(A) = a(2) = 4.
For n = 3 the matrix A is
   1, 2, 3
   8, 9, 4
   7, 6, 5
with Tr(A) = a(3) = 15.
For n = 4 the matrix A is
   1,  2,  3, 4
  12, 13, 14, 5
  11, 16, 15, 6
  10,  9,  8, 7
with Tr(A) = a(4) = 36.
		

Crossrefs

Cf. A126224 (determinant of the matrix A), A317298 (first differences).

Programs

  • GAP
    a_n:=List([1..43], n->(3 + 2*n - 3*n^2 + 4*n^3 - 3*RemInt(-1 + n, 2))/6);
    
  • GAP
    List([1..43],n->(3+2*n-3*n^2+4*n^3-3*((-1+n) mod 2))/6); # Muniru A Asiru, Sep 17 2018
  • Magma
    I:=[1,4,15,36,73]; [n le 5 select I[n] else 3*Self(n-1)-2*Self(n-2)-2*Self(n-3)+3*Self(n-4)-Self(n-5): n in [1..43]]; // Vincenzo Librandi, Aug 26 2018
    
  • Maple
    seq((3+2*n-3*n^2+4*n^3-3*modp((-1+n),2))/6,n=1..43); # Muniru A Asiru, Sep 17 2018
  • Mathematica
    Table[1/6 (3 + 2 n - 3 n^2 + 4 n^3 - 3 Mod[-1 + n, 2]), {n, 1, 43}] (* or *)
    CoefficientList[ Series[x*(1 + x + 5 x^2 + x^3)/((-1 + x)^4 (1 + x)), {x, 0, 43}], x] (* or *)
    LinearRecurrence[{3, -2, -2, 3, -1}, {1, 4, 15, 36, 73}, 43]
  • Maxima
    a(n):=(3 + 2*n - 3*n^2 + 4*n^3 - 3*mod(-1 + n, 2))/6$ makelist(a(n), n, 1, 43);
    
  • PARI
    Vec(x*(1 + x + 5*x^2 + x^3)/((-1 + x)^4*(1 + x)) + O(x^44))
    
  • PARI
    a(n) = (3 + 2*n - 3*n^2 + 4*n^3 - 3*((-1 + n)%2))/6
    

Formula

a(n) = A045991(n) - Sum_{k=2..n-1} A085046(k) for n > 2 (proved).
G.f.: x*(1 + x + 5 x^2 + x^3)/((-1 + x)^4 (1 + x)).
a(n) + a(n + 1) = A228958(2*n + 1).
From Colin Barker, Aug 17 2018: (Start)
a(n) = (2*n - 3*n^2 + 4*n^3) / 6 for n even.
a(n) = (3 + 2*n - 3*n^2 + 4*n^3) / 6 for n odd.
a(n) = 3*a(n - 1) - 2*a(n - 2) - 2*a(n - 3) + 3*a(n - 4) - a(n - 5) for n > 5.
(End)
E.g.f.: (1/12)*exp(-x)*(-3 + exp(2*x)*(3 + 6*x + 18*x^2 + 8*x^3)). - Stefano Spezia, Feb 10 2019
Showing 1-5 of 5 results.