login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A317617 Triangle T read by rows: T(n, k) = (n^3 + n)/2 + (k - (n + 1)/2)*(n mod 2). 6
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 (list; table; graph; refs; listen; history; text; internal format)
OFFSET
1,2
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.
LINKS
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
EXAMPLE
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.
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 *)
PROG
(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
(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
(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);
(Magma) [[(n^3 + n)/2 + (k - (n + 1)/2)*(n mod 2): k in [1..n]]: n in [1..11]];
(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
(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
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 oblique side of the triangle T.
Sequence in context: A286257 A168418 A266440 * A294750 A304300 A321653
KEYWORD
nonn,tabl
AUTHOR
Stefano Spezia, Aug 01 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 7 21:53 EDT 2024. Contains 372317 sequences. (Running on oeis4.)