A368434 Irregular triangular array T, read by rows: T(n,k) = number of sums |x-y|+|y-z| = k, where x,y,z are in {0,1,...,n}.
1, 2, 4, 2, 3, 8, 10, 4, 2, 4, 12, 18, 16, 8, 4, 2, 5, 16, 26, 28, 24, 12, 8, 4, 2, 6, 20, 34, 40, 40, 32, 18, 12, 8, 4, 2, 7, 24, 42, 52, 56, 52, 42, 24, 18, 12, 8, 4, 2, 8, 28, 50, 64, 72, 72, 66, 52, 32, 24, 18, 12, 8, 4, 2, 9, 32, 58, 76, 88, 92, 90, 80
Offset: 1
Examples
First eight rows: 1 2 4 2 3 8 10 4 2 4 12 18 16 8 4 2 5 16 26 28 24 12 8 4 2 6 20 34 40 40 32 18 12 8 4 2 7 24 42 52 56 52 42 24 18 12 8 4 2 8 28 50 64 72 72 66 52 32 24 18 12 8 4 2
Programs
-
Mathematica
t[n_] := t[n] = Tuples[Range[n], 3]; a[n_, k_] := Select[t[n], Abs[#[[1]] - #[[2]]] + Abs[#[[2]] - #[[3]]] == k &]; u = Table[Length[a[n, k]], {n, 1, 15}, {k, 0, 2 n - 2}]; Flatten[u] (* sequence *) Column[u] (* array *)
Comments