OFFSET
1,4
COMMENTS
See A285722.
LINKS
FORMULA
A(n,k) = A285722(k,n).
EXAMPLE
The top left 14 X 14 corner of the array:
0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91
1, 0, 2, 5, 9, 14, 20, 27, 35, 44, 54, 65, 77, 90
2, 3, 0, 4, 8, 13, 19, 26, 34, 43, 53, 64, 76, 89
4, 5, 6, 0, 7, 12, 18, 25, 33, 42, 52, 63, 75, 88
7, 8, 9, 10, 0, 11, 17, 24, 32, 41, 51, 62, 74, 87
11, 12, 13, 14, 15, 0, 16, 23, 31, 40, 50, 61, 73, 86
16, 17, 18, 19, 20, 21, 0, 22, 30, 39, 49, 60, 72, 85
22, 23, 24, 25, 26, 27, 28, 0, 29, 38, 48, 59, 71, 84
29, 30, 31, 32, 33, 34, 35, 36, 0, 37, 47, 58, 70, 83
37, 38, 39, 40, 41, 42, 43, 44, 45, 0, 46, 57, 69, 82
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 0, 56, 68, 81
56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 67, 80
67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 0, 79
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 0
MATHEMATICA
A[n_, n_] = 0;
A[n_, k_] /; k == n - 1 := (k^2 - k + 2)/2;
A[1, k_] := (k^2 - 3 k + 4)/2;
A[n_, k_] /; 1 <= k <= n - 2 := A[n, k] = A[n, k + 1] + 1;
A[n_, k_] /; k > n := A[n, k] = A[n - 1, k] + 1;
T[n_, k_] := A[k, n];
Table[T[n - k + 1, k], {n, 1, 14}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Nov 19 2019 *)
PROG
(Python)
def T(n, m): return ((n + m)**2 - n - 3*m + 2)//2
def A(n, k): return 0 if n == k else T(n - k, k) if n>k else T(n, k - n)
for n in range(1, 21): print([A(n - k + 1, k) for k in range(1, n + 1)]) # Indranil Ghosh, May 03 2017
CROSSREFS
KEYWORD
AUTHOR
Antti Karttunen, May 03 2017
STATUS
approved