How many ANDs and ORs does it take... Low-level bitwhacking at its most fun.
research.swtch.com
research.swtch.com
So, what's the worst case for n=5?
It turns out (http://boolean-oracle.swtch.com/?q=x%2by%2bz%2bw%2bv+in+0,1,...) that one of those three functions is the one that's true if and only if either 0, or 1, or 3 of the five variables are TRUE. (The other two are slight variations on that theme.)
It would be interesting to know whether the worst-case functions for larger n have as much symmetry as the worst cases for n<=5. (I'd guess not.)
I submit for your consideration the vast number of truth tables written and referenced by engineers of Boolean logic circuits over the last many decades.
"the least significant bit of the sum is by definition the parity of the set, so calculating the rest of the sum will only increase the number of operations required"
Can you expand on these two statements please? Examining the sum seemed like a more elegant solution when thinking in terms of higher level languages but the extent of my knowledge ends there. I'd really like to understand how sums compare in terms of actual operations.
It figures ;-)
The web site http://boolean-oracle.swtch.com lets you type in a Boolean expression and gives back the minimal formula for it.
Nice, thanks. I'd suggest adding that example inputs can be had from the column at right (took me a bit to notice).