OFFSET
0,2
COMMENTS
The array is read by descending antidiagonals as A(0,0), A(0,1), A(1,0), A(0,2), A(1,1), A(2,0), ...
LINKS
MathWorld, Pairing Function
FORMULA
EXAMPLE
The top left 0 .. 12 x 0 .. 12 corner of the array:
0, 4, 12, 24, 40, 60, 84, 112, 144, 180, 220, 264, 312
2, 1, 18, 17, 50, 49, 98, 97, 162, 161, 242, 241, 338
5, 13, 3, 11, 61, 85, 59, 83, 181, 221, 179, 219, 365
9, 8, 7, 6, 73, 72, 71, 70, 201, 200, 199, 198, 393
14, 26, 42, 62, 10, 22, 38, 58, 222, 266, 314, 366, 218
20, 19, 52, 51, 16, 15, 48, 47, 244, 243, 340, 339, 240
27, 43, 25, 41, 23, 39, 21, 37, 267, 315, 265, 313, 263
35, 34, 33, 32, 31, 30, 29, 28, 291, 290, 289, 288, 287
44, 64, 88, 116, 148, 184, 224, 268, 36, 56, 80, 108, 140
54, 53, 102, 101, 166, 165, 246, 245, 46, 45, 94, 93, 158
65, 89, 63, 87, 185, 225, 183, 223, 57, 81, 55, 79, 177
77, 76, 75, 74, 205, 204, 203, 202, 69, 68, 67, 66, 197
90, 118, 150, 186, 86, 114, 146, 182, 82, 110, 142, 178, 78
MATHEMATICA
T[a_, b_]:=((a + b)^2 + 3a + b)/2; A[n_, k_]:=T[BitXor[n, k], k]; Table[A[k, n - k ], {n, 0, 20}, {k, 0, n}] // Flatten (* Indranil Ghosh, May 21 2017 *)
PROG
(Scheme)
(define (A286145bi row col) (let ((a (A003987bi row col)) (b col)) (/ (+ (expt (+ a b) 2) (* 3 a) b) 2))) ;; Where A003987bi implements bitwise-xor (A003987).
(Python)
def T(a, b): return ((a + b)**2 + 3*a + b)//2
def A(n, k): return T(n^k, k)
for n in range(21): print([A(k, n - k) for k in range(n + 1)]) # Indranil Ghosh, May 21 2017
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Antti Karttunen, May 03 2017
STATUS
approved