I got the following code using bit operation from here:
lis = Complement[Range[0, 15], {7, 14, 15}]
ans = Tuples[lis, 3] //
Select[#,
BitAnd[#1, #2, #3] == 0 && BitAnd[4 #1, 2 #2, #3] == 0 &&
BitAnd[#1, 2 #2, 4 #3] == 0 & @@ # &] &;
nums = Length@ans
GroupBy[ans,
Total@Flatten@IntegerDigits[#, 2] &] // #[Max[Keys[#]]] & //
IntegerDigits[#, 2, 4] & // TableForm /@ # &
But I'm not familiar with bit operations. How can I understand the meaning of this code and find more examples of bit operations?
BitAndoperation (multiplication by a power of two acts as a position shifter). – kirma Mar 15 '20 at 06:46