Find the nim-sum of all numbers from $1$ to $((2^n)-1)$ where $n >1$ is a natural number

1.2k Views Asked by At

I started learning nim sum, the examples given in class were all two number kind of problem. What should I do with this kind of problem?

1

There are 1 best solutions below

0
On

So the nim-sum of any amount of numbers is determined by taking the binary representation of the numbers and where theres an odd number of 1's you take put a 1 and an even number you put a zero. So for example with:

1001
1111
0101

Our result is 0011 because we have 2 1's in the eights digit, 2 1's in the fours digit, 1 1 in the 2's digit, and 3 1's in the ones digit.

Let us write out the binary representations for the numbers up to n=3 for the original problem.

001
010
011
100
101
110
111

Note that we have an even number of digits in each slot, so the nim-sum is 0. This pattern continues for all n>1, where the nim-sum is 0.