OFFSET
0,3
COMMENTS
The top left 8 X 8 corner of the array is
+0 +1 +5 +4 20 21 17 16
+2 +3 +7 +6 22 23 19 18
10 11 15 14 30 31 27 26
+8 +9 13 12 28 29 25 24
40 41 45 44 60 61 57 56
42 43 47 46 62 63 59 58
34 35 39 38 54 55 51 50
32 33 37 36 52 53 49 48
By taking the top left 2 X 2 corner, 2 X 4 rectangle ((0,1,5,4),(2,3,7,6)) or 4 X 4 corner one obtains Karnaugh map templates for 2, 3 or 4 variables respectively (although not the standard ones usually given in the textbooks).
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..2079
Wikipedia, Karnaugh map
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 *)
PROG
(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
CROSSREFS
AUTHOR
Antti Karttunen, Jul 29 2009
STATUS
approved