OFFSET
1,1
LINKS
FORMULA
EXAMPLE
The top left 1 .. 12 x 1 .. 12 corner of the array:
2, 11, 7, 22, 16, 37, 29, 56, 46, 79, 67, 106
13, 5, 8, 38, 47, 23, 30, 80, 93, 57, 68, 138
8, 7, 9, 58, 48, 39, 31, 108, 94, 81, 69, 174
26, 42, 62, 14, 19, 25, 32, 140, 157, 175, 194, 82
19, 52, 51, 16, 20, 41, 33, 176, 158, 215, 195, 110
43, 25, 41, 23, 39, 27, 34, 216, 237, 177, 196, 142
34, 33, 32, 31, 30, 29, 35, 260, 238, 217, 197, 178
64, 88, 116, 148, 184, 224, 268, 44, 53, 63, 74, 86
53, 102, 101, 166, 165, 246, 245, 46, 54, 87, 75, 114
89, 63, 87, 185, 225, 183, 223, 57, 81, 65, 76, 146
76, 75, 74, 205, 204, 203, 202, 69, 68, 67, 77, 182
118, 150, 186, 86, 114, 146, 182, 82, 110, 142, 178, 90
MATHEMATICA
T[a_, b_]:=((a + b)^2 + 3a + b)/2; A[n_, k_]:=If[n>k, T[BitXor[n, k], k], T[n, BitXor[n, k]]]; Table[A[k, n - k + 1], {n, 20}, {k, n}] // Flatten (* Indranil Ghosh, May 21 2017 *)
PROG
(Python)
def T(a, b): return ((a + b)**2 + 3*a + b)/2
def A(n, k): return T(n^k, k) if n>k else T(n, n^k)
for n in range(1, 21): print [A(k, n - k + 1) for k in range(1, n + 1)] # Indranil Ghosh, May 21 2017
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Antti Karttunen, May 03 2017
STATUS
approved