### Bit Manipulation Problem

This post is a bit different from my usual content. It's not about Haskell or functional programming, and not strictly about software. But I think it's a nice little brain teaser that may be of interest. Some may view it as too much tedium (congruent to 3 or 4 mod 5 in Knuth's scoring system), but I found the multitude of beautiful patterns in this problem interesting enough that I didn't notice the tedium. Consider a chessboard with squares numbered as follows (in octal): 8| 70 71 72 73 74 75 76 77 7| 60 61 62 63 64 65 66 67 6| 50 51 52 53 54 55 56 57 5| 40 41 42 43 44 45 46 47 4| 30 31 32 33 34 35 36 37 3| 20 21 22 23 24 25 26 27 2| 10 11 12 13 14 15 16 17 1| 00 01 02 03 04 05 06 07 a b c d e f g h This is a natural 0-63 (decimal) numbering where the 3 high bits (first octal digit) of the position index indicate the row and the 3 low bits (second octal digit) indicate the column. This isn't the only way the chessboard can be enumerat