login
Triangle T(n, k, m) = (m*(n-k) + 1)*T(n-1, k-1, m) + (m*k + 1)*T(n-1, k, m) + m*f(n,k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1, f(n, k) = k if k <= floor(n/2) otherwise n-k, and m = 1, read by rows.
23

%I #8 Jan 11 2022 02:18:57

%S 1,1,1,1,5,1,1,14,14,1,1,33,94,33,1,1,72,442,442,72,1,1,151,1752,3818,

%T 1752,151,1,1,310,6306,25358,25358,6306,310,1,1,629,21390,144524,

%U 268852,144524,21390,629,1,1,1268,69822,746744,2312836,2312836,746744,69822,1268,1

%N Triangle T(n, k, m) = (m*(n-k) + 1)*T(n-1, k-1, m) + (m*k + 1)*T(n-1, k, m) + m*f(n,k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1, f(n, k) = k if k <= floor(n/2) otherwise n-k, and m = 1, read by rows.

%H G. C. Greubel, <a href="/A157207/b157207.txt">Rows n = 0..50 of the triangle, flattened</a>

%F T(n, k, m) = (m*(n-k) + 1)*T(n-1, k-1, m) + (m*k + 1)*T(n-1, k, m) + m*f(n,k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1, f(n, k) = k if k <= floor(n/2) otherwise n-k, and m = 1.

%F T(n, n-k, m) = T(n, k, m).

%F T(n, 1, 1) = A094002(n-1). - _G. C. Greubel_, Jan 10 2022

%e Triangle begins as:

%e 1;

%e 1, 1;

%e 1, 5, 1;

%e 1, 14, 14, 1;

%e 1, 33, 94, 33, 1;

%e 1, 72, 442, 442, 72, 1;

%e 1, 151, 1752, 3818, 1752, 151, 1;

%e 1, 310, 6306, 25358, 25358, 6306, 310, 1;

%e 1, 629, 21390, 144524, 268852, 144524, 21390, 629, 1;

%e 1, 1268, 69822, 746744, 2312836, 2312836, 746744, 69822, 1268, 1;

%t f[n_,k_]:= If[k<=Floor[n/2], k, n-k];

%t T[n_, k_, m_]:= T[n, k, m]= If[k==0 || k==n, 1, (m*(n-k)+1)*T[n-1,k-1,m] + (m*k+1)*T[n-1,k,m] + m*f[n,k]*T[n-2,k-1,m]];

%t Table[T[n,k,1], {n,0,10}, {k,0,n}]//Flatten (* modified by _G. C. Greubel_, Jan 10 2022 *)

%o (Sage)

%o def f(n,k): return k if (k <= n//2) else n-k

%o @CachedFunction

%o def T(n,k,m): # A157207

%o if (k==0 or k==n): return 1

%o else: return (m*(n-k) +1)*T(n-1,k-1,m) + (m*k+1)*T(n-1,k,m) + m*f(n,k)*T(n-2,k-1,m)

%o flatten([[T(n,k,1) for k in (0..n)] for n in (0..20)]) # _G. C. Greubel_, Jan 10 2022

%Y Cf. A007318 (m=0), this sequence (m=1), A157208 (m=2), A157209 (m=3).

%Y Cf. A157147, A157148, A157149, A157150, A157151, A157152, A157153, A157154, A157155, A157156, A157210, A157211, A157212, A157268, A157272, A157273, A157274, A157275.

%Y Cf. A094002.

%K nonn,tabl

%O 0,5

%A _Roger L. Bagula_, Feb 25 2009

%E Edited by _G. C. Greubel_, Jan 10 2022