OFFSET
0,2
COMMENTS
This triangle read by rows yields a permutation of the natural numbers.
FORMULA
T(n, 0) = (n+5)*n/2 + 1 + (n^2 mod 3) for n >= 0.
T(n, n) = (n-1)*n/2 + 1 + (n^2 mod 3) for n >= 0.
T(2*n, n) = 2*n*(n+1) + 1 + (n^2 mod 3) for n >= 0.
T(n, k) - T(n, k+1) = m = 3 for 0 <= k < n (compare with A109857 where m = 2 and with A038722, seen as a triangle, where m = 1).
G.f. of column k = 0: F(t, 0) = Sum_{n>=0} T(n, 0) * t^n = (1 + 3*t - t^3) / ((1 - t^3) * (1 - t)^2).
G.f.: F(t, x) = Sum_{n>=0, k=0..n} T(n, k) * x^k * t^n = (F(t, 0) - x * F(x*t, 0)) / (1 - x) - 3*x*t / ((1 - t) * (1 - x*t)^2).
Row sums are A006003(n+1) + (n^2 mod 3) * (n+1) for n >= 0.
EXAMPLE
Triangle T(n, k) for 0 <= k <= n starts:
n\k : 0 1 2 3 4 5 6 7 8 9 10 11 12
===========================================================
0 : 1
1 : 5 2
2 : 9 6 3
3 : 13 10 7 4
4 : 20 17 14 11 8
5 : 27 24 21 18 15 12
6 : 34 31 28 25 22 19 16
7 : 44 41 38 35 32 29 26 23
8 : 54 51 48 45 42 39 36 33 30
9 : 64 61 58 55 52 49 46 43 40 37
10 : 77 74 71 68 65 62 59 56 53 50 47
11 : 90 87 84 81 78 75 72 69 66 63 60 57
12 : 103 100 97 94 91 88 85 82 79 76 73 70 67
etc.
MAPLE
gf := (t^2*x-t*x-t-2)/(3*(t^2+t+1)*(t^2*x^2+t*x+1))+(5*t^2-10*t+8)/(3*(t-1)^3* (t*x-1))+(3*t-2)/((t-1)^2*(t*x-1)^2)+1/((t-1)*(t*x-1)^3):
sert := series(gf, t, 18): px := n -> simplify(coeff(sert, t, n)):
row := n -> local k; seq(coeff(px(n), x, k), k = 0..n):
for n from 0 to 12 do row(n) od; # Peter Luschny, Dec 02 2023
MATHEMATICA
T[n_, k_]:=(n+5)*n/2+1+Mod [n^2 , 3]-3*k; Table[T[n, k], {n, 0, 11}, {k, 0, n}] //Flatten (* Stefano Spezia, Dec 03 2023 *)
PROG
(PARI) T(n, k) = (n+5)*n/2+1+(n^2%3)-3*k
(Python)
def A367844Row(n):
Tn0 = (n + 5) * n // 2 + n ** 2 % 3 + 1
return [Tn0 - k * 3 for k in range(n + 1)]
for n in range(9): print(A367844Row(n)) # Peter Luschny, Dec 03 2023
(Python)
from math import isqrt, comb
def A367844(n): return ((a:=(m:=isqrt(k:=n+1<<1))-(k<=m*(m+1)))*(a+5)>>1)+1+a**2%3-3*(n-comb(a+1, 2)) # Chai Wah Wu, Nov 12 2024
CROSSREFS
KEYWORD
AUTHOR
Werner Schulte, Dec 02 2023
STATUS
approved