login
Triangle read by rows: T(n, k) = (n-k)^n - n*k*(n-k) + k^n, with T(0, 0) = 1.
1

%I #9 Apr 26 2024 05:53:47

%S 1,1,1,4,0,4,27,3,3,27,256,70,16,70,256,3125,1005,245,245,1005,3125,

%T 46656,15596,4112,1404,4112,15596,46656,823543,279895,78183,18487,

%U 18487,78183,279895,823543,16777216,5764746,1679776,397066,130944,397066

%N Triangle read by rows: T(n, k) = (n-k)^n - n*k*(n-k) + k^n, with T(0, 0) = 1.

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

%F T(n, k) = (n-k)^n - n*k*(n-k) + k^n, with T(0, 0) = 1.

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

%e Triangle begins as:

%e 1;

%e 1, 1;

%e 4, 0, 4;

%e 27, 3, 3, 27;

%e 256, 70, 16, 70, 256;

%e 3125, 1005, 245, 245, 1005, 3125;

%e 46656, 15596, 4112, 1404, 4112, 15596, 46656;

%t T[n_, k_]= If[n==0, 1, k^n +(n-k)^n -n*k*(n-k)];

%t Table[T[n,k], {n,0,12}, {k,0,n}]//Flatten

%o (Magma)

%o [n eq 0 select 1 else (n-k)^n - n*k*(n-k) + k^n: k in [0..n], n in [0..12]]; // _G. C. Greubel_, Apr 26 2024

%o (SageMath)

%o flatten([[(n-k)^n - n*k*(n-k) + k^n - int(n==0) for k in range(n+1)] for n in range(13)]) # _G. C. Greubel_, Apr 26 2024

%K nonn,tabl

%O 0,4

%A _Roger L. Bagula_, Jun 08 2007

%E Edited by _G. C. Greubel_, Apr 26 2024