OFFSET
1,2
COMMENTS
The array is read by descending antidiagonals as A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), etc.
LINKS
MathWorld, Pairing Function
FORMULA
EXAMPLE
The top left 1 .. 12 x 1 .. 12 corner of the array:
-1, 4, 2, 11, 7, 22, 16, 37, 29, 56, 46, 79
6, -2, 3, 23, 30, 12, 17, 57, 68, 38, 47, 107
3, 2, -3, 39, 31, 24, 18, 81, 69, 58, 48, 139
15, 27, 43, -4, 10, 14, 19, 109, 124, 140, 157, 59
10, 35, 34, 7, -5, 26, 20, 141, 125, 176, 158, 83
28, 14, 26, 12, 24, -6, 21, 177, 196, 142, 159, 111
21, 20, 19, 18, 17, 16, -7, 217, 197, 178, 160, 143
45, 65, 89, 117, 149, 185, 225, -8, 36, 44, 53, 63
36, 77, 76, 133, 132, 205, 204, 29, -9, 64, 54, 87
66, 44, 64, 150, 186, 148, 184, 38, 58, -10, 55, 115
55, 54, 53, 168, 167, 166, 165, 48, 47, 46, -11, 147
91, 119, 151, 63, 87, 115, 147, 59, 83, 111, 143, -12
PROG
(Scheme)
(define (A286155bi row col) (cond ((= row col) (- row)) ((> row col) (A000027bi (A003987bi row col) col)) (else (A000027bi row (A003987bi col row))))) ;; Where A003987bi implements bitwise-xor (A003987).
(define (A000027bi row col) (* (/ 1 2) (+ (expt (+ row col) 2) (- row) (- (* 3 col)) 2)))
CROSSREFS
KEYWORD
sign,tabl
AUTHOR
Antti Karttunen, May 03 2017
STATUS
approved