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.

A317617 Triangle T read by rows: T(n, k) = (n^3 + n)/2 + (k - (n + 1)/2)*(n mod 2).

Original entry on oeis.org

1, 5, 5, 14, 15, 16, 34, 34, 34, 34, 63, 64, 65, 66, 67, 111, 111, 111, 111, 111, 111, 172, 173, 174, 175, 176, 177, 178, 260, 260, 260, 260, 260, 260, 260, 260, 365, 366, 367, 368, 369, 370, 371, 372, 373, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 666
Offset: 1

Views

Author

Stefano Spezia, Aug 01 2018

Keywords

Comments

T(n, k) is the sum of the terms of the k-th column of an n X n square matrix M formed by writing the numbers 1, ..., n^2 successively forward and backward along the rows in zig-zag pattern (proved). The n X n square matrix M is defined as M[i, j, n] = j + n*(i - 1) if i is odd and M[i, j, n] = n*i - j + 1 if i is even (see the examples below).
The rows of even indices of the triangle T are made of all the same repeating number.

Examples

			n\k|   1   2   3   4   5   6
---+------------------------
1  |   1
2  |   5   5
3  |  14  15  16
4  |  34  34  34  34
5  |  63  64  65  66  67
6  | 111 111 111 111 111 111
...
For n = 1 the matrix M is
  1
with column sum 1.
For n = 2 the matrix M is
  1, 2
  4, 3
with column sums 5, 5.
For n = 3 the matrix M is
  1, 2, 3
  6, 5, 4
  7, 8, 9
with column sums 14, 15, 16.
		

Crossrefs

Cf. A006003, A000027, A000035, A037270 (row sums).
A317614(n): the trace of the n X n square matrix M.
A074147(n): the elements of the antidiagonal of the n X n square matrix M.
A241016(n): the triangle of the row sums of the n X n square matrix M.
A246697(n): the right diagonal of the triangle T.

Programs

  • GAP
    A317617 := function(n)
    local i, j, t;
    for i in [1 .. n] do
       for j in [1 .. i] do
          t := (i^3 + i)/2 + (j - (i + 1)/2)*(i mod 2);
          Print(t, "\t");
       od;
       Print("\n");
    od;
    end;
    A317617(11); # yields sequence in triangular form
    
  • GAP
    Flat(List([1..11],n->List([1..n],k->(n^3+n)/2+(k-(n+1)/2)*(n mod 2)))); # Muniru A Asiru, Aug 24 2018
  • Magma
    [[(n^3 + n)/2 + (k - (n + 1)/2)*(n mod 2): k in [1..n]]: n in [1..11]];
    
  • Maple
    a:=(n,k)->(n^3+n)/2+(k-(n+1)/2)*modp(n,2): seq(seq(a(n,k),k=1..n),n=1..11); # Muniru A Asiru, Aug 24 2018
  • Mathematica
    f[n_] := Table[SeriesCoefficient[(x*(x*(5 - 7*y) + x^4*(1 - 2*y) - x^3*(-3 + y) - 3*x^2*(-1 + y) + y))/((-1 + x)^4*(1 + x)^2*(-1 + y)^2), {x, 0, i}, {y, 0, j}], {i, n, n}, {j, 1, n}]; Flatten[Array[f, 11]]
    T[i_, j_, n_] := If[OddQ@ i, j + n*(i - 1), n*i - j + 1]; f[n_] := Plus @@@ Transpose[ Table[T[i, j, n], {i, n}, {j, n}]]; Array[f, 11] // Flatten  (* Robert G. Wilson v, Aug 01 2018 *)
    f[n_] := Table[SeriesCoefficient[1/4 E^(-x + y) (1 - x - 2 y + E^(2 x) (-1 + 3 x + 6 x^2 + 2 x^3 + 2 y)), {x, 0, i}, {y, 0, j}]*i!*j!, {i, n, n}, {j, 1, n}]; Flatten[Array[f, 11]] (* Stefano Spezia, Jan 10 2019 *)
  • Maxima
    sjoin(v, j) := apply(sconcat, rest(join(makelist(j, length(v)), v)))$ display_triangle(n) := for i from 1 thru n do disp(sjoin(makelist((i^3+i)/2+(j-(i+1)/2)*mod(i, 2), j, 1, i), " ")); display_triangle(10);
    
  • PARI
    M(i,j,n) = if (i % 2, j + n*(i-1), n*i - j + 1);
    T(n, k) = sum(i=1, n, M(i,k,n));
    tabl(nn) = for(n=1, nn, for(k=1, n, print1(T(n,k), ", ")); print); \\ Michel Marcus, Aug 09 2018
    
  • R
    # by formula
    for (n in 1:11){
       t <- c(n, "")
       for(j in 1:n){
          t <- c(t, (n^3+n)/2+(j-(n+1)/2)*(n%%2), "")
       }
       cat(t, "\n")
    } # yields sequence in triangular form
    (MATLAB and FreeMat)
    for(i=1:11);
       for(j=1:i);
          t=(i^3 + i)/2 + (j - (i + 1)/2)*mod(i,2);
          fprintf('%0.f\t', t);
       end
       fprintf('\n');
    end % yields sequence in triangular form
    

Formula

T(n, k) = A006003(n) + (k - (A000027(n) + 1)/2)*A000035(n).
G.f.: x*(x*(5 - 7*y) + x^4*(1 - 2*y) - x^3*(- 3 + y) - 3*x^2*(- 1 + y) + y)/((-1 + x)^4*(1 + x)^2*(-1 + y)^2).
E.g.f.: (1/4)*exp(-x + y)*(1 - x - 2*y + exp(2*x)*(-1 + 3*x + 6*x^2 + 2*x^3 + 2*y)). - Stefano Spezia, Jan 10 2019

A317297 a(n) = (n - 1)*(4*n^2 - 8*n + 5).

Original entry on oeis.org

0, 5, 34, 111, 260, 505, 870, 1379, 2056, 2925, 4010, 5335, 6924, 8801, 10990, 13515, 16400, 19669, 23346, 27455, 32020, 37065, 42614, 48691, 55320, 62525, 70330, 78759, 87836, 97585, 108030, 119195, 131104, 143781, 157250, 171535, 186660, 202649, 219526, 237315, 256040, 275725, 296394, 318071
Offset: 1

Views

Author

Omar E. Pol, Sep 01 2018

Keywords

Comments

Conjecture: For n > 1, a(n) is the maximum eigenvalue of a 2*(n-1) X 2*(n-1) square matrix M defined as M[i,j,n] = j + n*(i-1) if i is odd and M[i,j,n] = n*i - j + 1 if i is even (see A317614). - Stefano Spezia, Dec 27 2018
Connections can be made to A022144 and A010014. Namely, a formula for A022144 is (2*n+1)^2 - (2*n-1)^2. A formula for A010014 is (2*n+1)^3 - (2*n-1)^3. The general form can be represented by (2*n+1)^d - (2*n-1)^d, where d designates the number of dimensions. When d is 4, a(n) = ((2*(n-1)+1)^4 - (2*(n-1)-1)^4)/16, namely the general form shifted by 1 and divided by 16 is a(n). - Yigit Oktar, Aug 16 2024

Crossrefs

First bisection of A006003.
Nonzero terms give the row sums of A007607.
Conjecture: 0 together with a bisection of A246697.
Cf. A219086 (partial sums).
Cf. A010014, A022144 (see comments)

Programs

  • Mathematica
    Table[(n - 1) (4 n^2 - 8 n + 5), {n, 1, 50}] (* or *) LinearRecurrence[{4, -6, 4, -1}, {0, 5, 34, 111}, 50] (* or *) CoefficientList[Series[x (5 + 14 x + 5 x^2)/(1 - x)^4, {x, 0, 50}], x] (* Stefano Spezia, Sep 01 2018 *)
  • PARI
    a(n) = (n - 1)*(4*n^2 - 8*n + 5)
    
  • PARI
    concat(0, Vec(x^2*(5 + 14*x + 5*x^2)/(1 - x)^4 + O(x^50))) \\ Colin Barker, Sep 01 2018

Formula

a(n) = 4*n^3 - 12*n^2 + 13*n - 5 = A033430(n) - A135453(n) + A008595(n) - 5.
G.f.: x^2*(5 + 14*x + 5*x^2)/(1 - x)^4. - Colin Barker, Sep 01 2018
a(n) = 4*a(n - 1) - 6*a(n - 2) + 4*a(n - 3) - a(n - 4) for n > 4. - Stefano Spezia, Sep 01 2018
E.g.f.: exp(x)*(5*x + 12*x^2 + 4*x^3). - Stefano Spezia, Jan 15 2019
a(n) = ((2*(n-1)+1)^4 - (2*(n-1)-1)^4)/16. - Yigit Oktar, Aug 16 2024

A246696 Triangle t(n,k) = t(n,k-2) + 2 if n > 1 and 2 <= k <= n; t(0,0) = 1, t(1,0) = 2, t(1,1) = 3; if n > 1 is odd, then t(n,0) = t(n-1,n-2) + 2 and t(n,1) = t(n-1,n-1) + 2; if n > 1 is even, then t(n,0) = t(n-1,n-1) + 2 and t(n,1) = t(n-1,n-2) + 2.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 13, 10, 15, 12, 17, 14, 19, 16, 21, 18, 23, 25, 20, 27, 22, 29, 24, 31, 26, 33, 28, 35, 30, 37, 32, 39, 41, 34, 43, 36, 45, 38, 47, 40, 49, 42, 51, 44, 53, 46, 55, 48, 57, 50, 59, 61, 52, 63, 54, 65, 56, 67, 58, 69, 60, 71, 62
Offset: 0

Views

Author

Clark Kimberling, Sep 17 2014

Keywords

Comments

As an array, for each m, row 2*m has m even numbers and [(m+1)/2] odd numbers, and row 2*m-1 has m odds and m evens. Every positive number occurs exactly once, so that as a sequence (with offset 1), this is a permutation of the positive integers, with inverse A246698.

Examples

			First 8 rows:
1
2 ... 3
5 ... 4 ... 7
6 ... 9 ... 8 ... 11
13 .. 10 .. 15 .. 12 .. 17
14 .. 19 .. 16 .. 21 .. 18 .. 23
25 .. 20 .. 27 .. 22 .. 29 .. 24 .. 31
26 .. 33 .. 28 .. 35 .. 30 .. 37 .. 32 .. 39
		

Crossrefs

Cf. A246697 (row sums), A246698 (inverse permutation), A246694.
Cf. A001844, A047838 (main diagonal), A128174 (parity).

Programs

  • Mathematica
    z = 25; t[0, 0] = 1; t[1, 0] = 2; t[1, 1] = 3; t[n_, 0] := t[n, 0] = If[OddQ[n], t[n - 1, n - 2] + 2, t[n - 1, n - 1] + 2]; t[n_, 1] := t[n, 1] = If[OddQ[n], t[n - 1, n - 1] + 2, t[n - 1, n - 2] + 2]; t[n_, k_] := t[n, k] = t[n, k - 2] + 2;
    u = Flatten[Table[t[n, k], {n, 0, z}, {k, 0, n}]] (* A246696 *)

Formula

For m >= 0, {t(2*m,0)} = A001844. - Ruud H.G. van Tol, Sep 30 2024

Extensions

Edited by M. F. Hasler, Nov 17 2014

A246698 Inverse of A246696 considered as a permutation of the positive integers.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 6, 9, 8, 12, 10, 14, 11, 16, 13, 18, 15, 20, 17, 23, 19, 25, 21, 27, 22, 29, 24, 31, 26, 33, 28, 35, 30, 38, 32, 40, 34, 42, 36, 44, 37, 46, 39, 48, 41, 50, 43, 52, 45, 54, 47, 57, 49, 59, 51, 61, 53, 63, 55, 65, 56, 67, 58, 69, 60, 71, 62
Offset: 1

Views

Author

Clark Kimberling, Sep 02 2014

Keywords

Crossrefs

Programs

  • Mathematica
    z = 25; t[0, 0] = 1; t[1, 0] = 2; t[1, 1] = 3; t[n_, 0] := t[n, 0] = If[OddQ[n], t[n - 1, n - 2] + 2, t[n - 1, n - 1] + 2]; t[n_, 1] := t[n, 1] = If[OddQ[n], t[n - 1, n - 1] + 2, t[n - 1, n - 2] + 2]
    t[n_, k_] := t[n, k] = t[n, k - 2] + 2;
    u = Flatten[Table[t[n, k], {n, 0, z}, {k, 0, n}]] (* A246696 *)
    Flatten[Table[Position[u, n], {n, 1, 80}]]  (* A246698 *)

Extensions

Definition corrected and edited by M. F. Hasler, Nov 17 2014

A376182 Triangle T read by rows: T(n, k) = (2*n^2 + 4*n + 1 - (-1)^n) / 4 - (1 + (-1)^k) * (n - k) - k.

Original entry on oeis.org

1, 3, 2, 7, 4, 5, 11, 6, 9, 8, 17, 10, 15, 12, 13, 23, 14, 21, 16, 19, 18, 31, 20, 29, 22, 27, 24, 25, 39, 26, 37, 28, 35, 30, 33, 32, 49, 34, 47, 36, 45, 38, 43, 40, 41, 59, 42, 57, 44, 55, 46, 53, 48, 51, 50, 71, 52, 69, 54, 67, 56, 65, 58, 63, 60, 61, 83, 62, 81, 64, 79, 66, 77, 68, 75, 70, 73, 72
Offset: 1

Views

Author

Werner Schulte, Sep 14 2024

Keywords

Comments

Conjecture: This triangle seen as a sequence yields a permutation of the natural numbers.

Examples

			Triangle T(n, k) for 1 <= k <= n starts:
n \k :   1   2   3   4   5   6   7   8   9  10  11  12
======================================================
   1 :   1
   2 :   3   2
   3 :   7   4   5
   4 :  11   6   9   8
   5 :  17  10  15  12  13
   6 :  23  14  21  16  19  18
   7 :  31  20  29  22  27  24  25
   8 :  39  26  37  28  35  30  33  32
   9 :  49  34  47  36  45  38  43  40  41
  10 :  59  42  57  44  55  46  53  48  51  50
  11 :  71  52  69  54  67  56  65  58  63  60  61
  12 :  83  62  81  64  79  66  77  68  75  70  73  72
  etc.
		

Crossrefs

Main diagonal is A000982.
Column 1 is A047838(n+1).
Column 2 is 2*A033638.
Cf. A246696 (permutation by row), A246697 (row sums), A376583 (parity).

Programs

  • PARI
    T(n,k)=(2*n^2+4*n+1-(-1)^n)/4-k-(1+(-1)^k)*(n-k)

Formula

T(n, k) = T(n, k-1) - (-1)^k * (2*n - 2*k + 1) for 2 <= k <= n.
T(n, k) = T(n, k-2) + 2 * (-1)^k for 3 <= k <= n.
Row sums: Sum_{k=1..n} T(n, k) = (n^3 + n) / 2 + (n - 1) * (1 - (-1)^n) / 4.
G.f.: x*y*(1 + x + x^2*(1 - y)^2 - 3*x^5*y^2 + 2*x^6*y^3 + x^4*y*(4 + y) - x^3*(1 + 4*y + y^2))/((1 - x)^3*(1 + x)*(1 - x*y)^3*(1 + x*y)). - Stefano Spezia, Sep 16 2024
From Ruud H.G. van Tol, Sep 22 2024: (Start)
T(n, 1) = A047838(n+1).
T(n, 2) = A033638(n) * 2.
T(n, n) = A000982(n) = (T(n, 1) + T(n, 2) - 1) / 2 for n >= 2. (End)
Showing 1-5 of 5 results.