A163233 Two-dimensional Binary Reflected Gray Code: a(i,j) = bits of binary expansion of A003188(i) interleaved with that of A003188(j).
0, 1, 2, 5, 3, 10, 4, 7, 11, 8, 20, 6, 15, 9, 40, 21, 22, 14, 13, 41, 42, 17, 23, 30, 12, 45, 43, 34, 16, 19, 31, 28, 44, 47, 35, 32, 80, 18, 27, 29, 60, 46, 39, 33, 160, 81, 82, 26, 25, 61, 62, 38, 37, 161, 162, 85, 83, 90, 24, 57, 63, 54, 36, 165, 163, 170, 84, 87, 91
Offset: 0
Links
- Antti Karttunen, Table of n, a(n) for n = 0..2079
- Wikipedia, Karnaugh map
- Index entries for sequences that are permutations of the natural numbers
Crossrefs
Programs
-
Mathematica
Table[Function[k, FromDigits[#, 2] &@ Apply[Function[{a, b}, Riffle @@ Map[PadLeft[#, Max[Length /@ {a, b}]] &, {a, b}]], Map[IntegerDigits[#, 2] &@ BitXor[#, Floor[#/2]] &, {k, j}]]][i - j], {i, 0, 11}, {j, i, 0, -1}] // Flatten (* Michael De Vlieger, Jun 25 2017 *)
-
Python
def a000695(n): n=bin(n)[2:] x=len(n) return sum([int(n[i])*4**(x - 1 - i) for i in range(x)]) def a003188(n): return n^(n>>1) def a(n, k): return a000695(a003188(n)) + 2*a000695(a003188(k)) for n in range(21): print([a(n - k, k) for k in range(n + 1)]) # Indranil Ghosh, Jun 25 2017
-
Scheme
(define (A163233bi x y) (+ (A000695 (A003188 x)) (* 2 (A000695 (A003188 y))))) (define (A163233 n) (A163233bi (A025581 n) (A002262 n)))
Comments