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.

A340804 Triangle read by rows: T(n, k) = 1 + k*(n - 1) + (2*k - n - 1)*(k mod 2) with 0 < k <= n.

Original entry on oeis.org

1, 1, 3, 1, 5, 9, 1, 7, 11, 13, 1, 9, 13, 17, 25, 1, 11, 15, 21, 29, 31, 1, 13, 17, 25, 33, 37, 49, 1, 15, 19, 29, 37, 43, 55, 57, 1, 17, 21, 33, 41, 49, 61, 65, 81, 1, 19, 23, 37, 45, 55, 67, 73, 89, 91, 1, 21, 25, 41, 49, 61, 73, 81, 97, 101, 121, 1, 23, 27, 45, 53, 67, 79, 89, 105, 111, 131, 133
Offset: 1

Views

Author

Stefano Spezia, Jan 22 2021

Keywords

Comments

T(n, k) is the k-th diagonal element of an n X n square matrix M(n) formed by writing the numbers 1, ..., n^2 successively forward and backward along the rows in zig-zag pattern.
It includes exclusively all the odd numbers (A005408). Except the term 1, all the other odd numbers appear a finite number of times.

Examples

			1
1,  3
1,  5,  9,
1,  7, 11, 13
1,  9, 13, 17, 25
1, 11, 15, 21, 29, 31
1, 13, 17, 25, 33, 37, 49
...
		

Crossrefs

Cf. A005408, A317614 (row sums).
Cf. A000012 (1st column), A006010 (sum of the first n rows), A060747 (2nd column), A074147 (antidiagonals of M matrices), A241016 (row sums of M matrices), A317617 (column sums of M matrices), A322277 (permanent of M matrices), A323723 (subdiagonal sum of M matrices), A323724 (superdiagonal sum of M matrices).

Programs

  • Mathematica
    Table[1+k(n-1)+(2k-n-1)Mod[k,2],{n,12},{k,n}]//Flatten
  • PARI
    T(n, k) = 1 + k*(n - 1) + (2*k - n - 1)*(k % 2); \\ Michel Marcus, Jan 25 2021

Formula

O.g.f.: (1 + y - 3*y^2 + y^3 + x*(-1 - y + 5*y^2 + y^3))/((-1 + x)^2*(-1 + y)^2*(1+y)^2).
E.g.f.: exp(x - y)*(1 + x + 2*y + exp(2*y)*(1 + x*(-1 + 2*y)))/2.