[0]: https://link.springer.com/article/10.1007/s10676-024-09775-5
1. The largest power of 2 that divides x is just 2^(number of trailing zeros in x)
2. Crucial observation: -x == ~x + 1
3. ~x flips all the bits of x bits, so none of the bits of ~x match those of x. (i.e. (x & ~x) == 0)
4. When you do +1, all the trailing 1's flip AGAIN, becoming zero like they were in x. The next highest 0 (say it was the n'th) also flips, becoming 1... like it was in x.
5. Crucial observation: The n'th 0 did NOT match the corresponding bit in x prior to the increment, therefore it MUST match after the increment. All higher bits stay as-is.
6. This leaves only the n'th bits matching in x and ~x + 1, isolating the highest power-of-2 divisor of x when you AND them.
x = y | 1 | z
-x = ~x + 1
-x = (~y | 0 | ~z) + 1
-x = ~y | 1 | z
x & -x = (y & ~y) | (1 & 1) | (z & z)
x & -x = 0 | 1 | z
Deleted Comment
There's two reading errors I would expect someone to make given this experiment:
1. The instructions that each card has exactly one letter and exactly one number are before the big cards. I bet many players just skipped that instruction.
2. Mistaking the P→Q as P←→Q smacks more of a reading comprehension error than a logical error.
Disclosure: I made both mistakes. (-:
they can plausibly sue people other than stackoverflow if they attempt to reuse the answers under a different license. but i think it's very difficult to find a use that 4.0 permits that 3.0 doesn't
https://doctorow.medium.com/a-bug-in-early-creative-commons-...
I haven't noticed a grading/ranking difference, but far more frequently I'll hear that "oh, we ran out of item/time/etc. before we got to you", which has made me much more sensitive to issues of planning/organization.