login
Square array read by antidiagonals: A(n,k) = T(n XOR k, n), where T(n,k) is sequence A001477 considered as a two-dimensional table, and XOR is bitwise-xor (A003987)
6

%I #17 Apr 30 2021 06:04:12

%S 0,2,4,5,1,12,9,13,18,24,14,8,3,17,40,20,26,7,11,50,60,27,19,42,6,61,

%T 49,84,35,43,52,62,73,85,98,112,44,34,25,51,10,72,59,97,144,54,64,33,

%U 41,16,22,71,83,162,180,65,53,88,32,23,15,38,70,181,161,220,77,89,102,116,31,39,48,58,201,221,242,264,90,76,63,101,148,30,21,47,222,200,179,241,312

%N Square array read by antidiagonals: A(n,k) = T(n XOR k, n), where T(n,k) is sequence A001477 considered as a two-dimensional table, and XOR is bitwise-xor (A003987)

%C 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), ...

%H Antti Karttunen, <a href="/A286147/b286147.txt">Table of n, a(n) for n = 0..10584; the first 145 antidiagonals of array</a>

%H MathWorld, <a href="http://mathworld.wolfram.com/PairingFunction.html">Pairing Function</a>

%F A(n,k) = T(A003987(n,k), n), where T(n,k) is sequence A001477 considered as a two-dimensional table, that is, as a pairing function from [0, 1, 2, 3, ...] x [0, 1, 2, 3, ...] to [0, 1, 2, 3, ...].

%e The top left 0 .. 12 x 0 .. 12 corner of the array:

%e 0, 2, 5, 9, 14, 20, 27, 35, 44, 54, 65, 77, 90

%e 4, 1, 13, 8, 26, 19, 43, 34, 64, 53, 89, 76, 118

%e 12, 18, 3, 7, 42, 52, 25, 33, 88, 102, 63, 75, 150

%e 24, 17, 11, 6, 62, 51, 41, 32, 116, 101, 87, 74, 186

%e 40, 50, 61, 73, 10, 16, 23, 31, 148, 166, 185, 205, 86

%e 60, 49, 85, 72, 22, 15, 39, 30, 184, 165, 225, 204, 114

%e 84, 98, 59, 71, 38, 48, 21, 29, 224, 246, 183, 203, 146

%e 112, 97, 83, 70, 58, 47, 37, 28, 268, 245, 223, 202, 182

%e 144, 162, 181, 201, 222, 244, 267, 291, 36, 46, 57, 69, 82

%e 180, 161, 221, 200, 266, 243, 315, 290, 56, 45, 81, 68, 110

%e 220, 242, 179, 199, 314, 340, 265, 289, 80, 94, 55, 67, 142

%e 264, 241, 219, 198, 366, 339, 313, 288, 108, 93, 79, 66, 178

%e 312, 338, 365, 393, 218, 240, 263, 287, 140, 158, 177, 197, 78

%t T[a_, b_]:=((a + b)^2 + 3a + b)/2; A[n_, k_]:=T[BitXor[n, k], k]; Table[A[n - k, k], {n, 0, 20}, {k, 0, n}] // Flatten (* _Indranil Ghosh_, May 21 2017 *)

%o (Scheme)

%o (define (A286147 n) (A286147bi (A002262 n) (A025581 n)))

%o (define (A286147bi row col) (let ((a (A003987bi row col)) (b row)) (/ (+ (expt (+ a b) 2) (* 3 a) b) 2))) ;; Where A003987bi implements bitwise-xor (A003987).

%o (Python)

%o def T(a, b): return ((a + b)**2 + 3*a + b)//2

%o def A(n, k): return T(n^k, k)

%o for n in range(21): print([A(n - k, k) for k in range(n + 1)]) # _Indranil Ghosh_, May 21 2017

%Y Transpose: A286145.

%Y Cf. A000096 (row 0), A046092 (column 0), A000217 (main diagonal).

%Y Cf. A003987, A001477, A286108, A286109, A286150, A286151.

%K nonn,tabl

%O 0,2

%A _Antti Karttunen_, May 03 2017