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, 2, 5, 9, 14, 20, 27, 35, 44, 54, 65, 77, 90
2, 4, 9, 13, 20, 26, 35, 43, 54, 64, 77, 89, 104
5, 9, 12, 18, 27, 35, 42, 52, 65, 77, 88, 102, 119
9, 13, 18, 24, 35, 43, 52, 62, 77, 89, 102, 116, 135
14, 20, 27, 35, 40, 50, 61, 73, 90, 104, 119, 135, 148
20, 26, 35, 43, 50, 60, 73, 85, 104, 118, 135, 151, 166
27, 35, 42, 52, 61, 73, 84, 98, 119, 135, 150, 168, 185
35, 43, 52, 62, 73, 85, 98, 112, 135, 151, 168, 186, 205
44, 54, 65, 77, 90, 104, 119, 135, 144, 162, 181, 201, 222
54, 64, 77, 89, 104, 118, 135, 151, 162, 180, 201, 221, 244
65, 77, 88, 102, 119, 135, 150, 168, 181, 201, 220, 242, 267
77, 89, 102, 116, 135, 151, 168, 186, 201, 221, 242, 264, 291
90, 104, 119, 135, 148, 166, 185, 205, 222, 244, 267, 291, 312
MATHEMATICA
T[a_, b_]:=((a + b)^2 + 3a + b)/2; A[n_, k_]:=T[BitOr[n, k], BitAnd[n, k]]; Table[A[n - k, k], {n, 0, 20}, {k, 0, n}] // Flatten (* Indranil Ghosh, May 21 2017 *)
PROG
(Scheme)
(define (A286099bi row col) (let ((a (A003986bi row col)) (b (A004198bi row col))) (/ (+ (expt (+ a b) 2) (* 3 a) b) 2))) ;; Here A003986bi and A004198bi implement bitwise-OR (A003986) 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, n&k)
for n in range(0, 21): print [A(k, n - k) for k in range(0, n + 1)] # Indranil Ghosh, May 21 2017
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Antti Karttunen, May 03 2017
STATUS
approved