OFFSET
0,4
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, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78
1, 5, 6, 12, 15, 23, 28, 38, 45, 57, 66, 80, 91
3, 6, 14, 19, 21, 28, 40, 49, 55, 66, 82, 95, 105
6, 12, 19, 27, 28, 38, 49, 61, 66, 80, 95, 111, 120
10, 15, 21, 28, 44, 53, 63, 74, 78, 91, 105, 120, 144
15, 23, 28, 38, 53, 65, 74, 88, 91, 107, 120, 138, 161
21, 28, 40, 49, 63, 74, 90, 103, 105, 120, 140, 157, 179
28, 38, 49, 61, 74, 88, 103, 119, 120, 138, 157, 177, 198
36, 45, 55, 66, 78, 91, 105, 120, 152, 169, 187, 206, 226
45, 57, 66, 80, 91, 107, 120, 138, 169, 189, 206, 228, 247
55, 66, 82, 95, 105, 120, 140, 157, 187, 206, 230, 251, 269
66, 80, 95, 111, 120, 138, 157, 177, 206, 228, 251, 275, 292
78, 91, 105, 120, 144, 161, 179, 198, 226, 247, 269, 292, 324
MATHEMATICA
T[a_, b_]:=((a + b)^2 + 3a + b)/2; A[n_, k_]:=T[2*BitAnd[n, k], BitXor[n, k]]; Table[A[k, n - k ], {n, 0, 20}, {k, 0, n}] // Flatten (* Indranil Ghosh, May 20 2017 *)
PROG
(Scheme)
(define (A286108bi row col) (let ((a (* 2 (A004198bi row col))) (b (A003987bi 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(2*(n&k), 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