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
Eric Weisstein's World of Mathematics, Pairing Function
FORMULA
EXAMPLE
The top left 0 .. 12 x 0 .. 12 corner of the array:
0, 2, 5, 9, 14, 20, 27, 35, 44, 54, 65, 77, 90
2, 3, 9, 12, 20, 25, 35, 42, 54, 63, 77, 88, 104
5, 9, 10, 16, 27, 35, 40, 50, 65, 77, 86, 100, 119
9, 12, 16, 21, 35, 42, 50, 59, 77, 88, 100, 113, 135
14, 20, 27, 35, 36, 46, 57, 69, 90, 104, 119, 135, 144
20, 25, 35, 42, 46, 55, 69, 80, 104, 117, 135, 150, 162
27, 35, 40, 50, 57, 69, 78, 92, 119, 135, 148, 166, 181
35, 42, 50, 59, 69, 80, 92, 105, 135, 150, 166, 183, 201
44, 54, 65, 77, 90, 104, 119, 135, 136, 154, 173, 193, 214
54, 63, 77, 88, 104, 117, 135, 150, 154, 171, 193, 212, 236
65, 77, 86, 100, 119, 135, 148, 166, 173, 193, 210, 232, 259
77, 88, 100, 113, 135, 150, 166, 183, 193, 212, 232, 253, 283
90, 104, 119, 135, 144, 162, 181, 201, 214, 236, 259, 283, 300
MATHEMATICA
T[a_, b_]:=((a + b)^2 + 3a + b)/2; A[n_, k_]:=T[BitXor[n, k], 2*BitAnd[n, k]]; Table[A[k, n - k ], {n, 0, 20}, {k, 0, n}] // Flatten (* Indranil Ghosh, May 20 2017 *)
PROG
(Scheme)
(define (A286109bi row col) (let ((a (A003987bi row col)) (b (* 2 (A004198bi row col)))) (/ (+ (expt (+ a b) 2) (* 3 a) b) 2))) ;; Here A003987bi and A004198bi implement bitwise-xor (A003987) and bitwise-and (A004198).
(Python)
def T(a, b): return ((a + b)**2 + 3*a + b)//2
def A(n, k): return T(n^k, 2*(n&k))
for n in range(21): print([A(k, n - k) for k in range(n + 1)]) # Indranil Ghosh, May 20 2017
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Antti Karttunen, May 03 2017
STATUS
approved