OFFSET
1,2
COMMENTS
This triangle seen as a sequence yields a permutation of the natural numbers. Next 8*i-5 odd numbers followed by next 8*i-1 even numbers fill next 2 + 2 rows (x, down, x+2, right, x+4, up, x+6, right, x+8, down, x+10, right, x+12, ...).
FORMULA
T(n, k) = T(n, k-1) + 4 - (-1)^n * (1 + (-1)^k) for 2 <= k <= n.
T(n, k) = T(n, k-2) + 8 for 3 <= k <= n.
T(n, n) = (n^2 + 4*n - (-1)^n * (n - 4)) / 2 - (1 + (-1)^n).
T(2*n-1, n) = 2 * n^2 - n + 1 + (-1)^n.
G.f.: x*y*(1+ 2*x^8*y^4 + x*(2 + 4*y) + x^7*y^3*(3 + 5*y) - x^6*y^2*(8 + 7*y + 2*y^2) - x^2*(3 - y - 3*y^2) + x^4*(6 + 3*y + y^2 + 3*y^3) - x^3*(2 + 9*y + 5*y^2 + 4*y^3) + x^5*y*(1 + y + 5*y^2 - y^3))/((1 - x)^3*(1 + x)^2*(1 - x*y)^3*(1 + x*y)^2). - Stefano Spezia, Sep 18 2024
EXAMPLE
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 5
3 : 2 8 10
4 : 4 6 12 14
5 : 7 13 15 21 23
6 : 9 11 17 19 25 27
7 : 16 22 24 30 32 38 40
8 : 18 20 26 28 34 36 42 44
9 : 29 35 37 43 45 51 53 59 61
10 : 31 33 39 41 47 49 55 57 63 65
11 : 46 52 54 60 62 68 70 76 78 84 86
12 : 48 50 56 58 64 66 72 74 80 82 88 90
etc.
PROG
(PARI) T(n, k)=(n^2-4*n-(-1)^n*(n-4))/2+4*k-(-1)^n*(1+(-1)^k)
CROSSREFS
KEYWORD
AUTHOR
Werner Schulte, Sep 17 2024
STATUS
approved