Artificial intelligent assistant

how do you calculate the grundy number? I want to calculate the grundy number of these 4 normal-play nim heaps: `0, 7, 7, 7` I'm confused when comparing two wikipedia pages: sprague-grundy suggests I should find the mex of these 4 numbers, which is `1`. while the nim page says I should XOR them all, which generates `7`. which is it?

The Grundy number is the nim-sum (i.e. the xor) of the numbers of items in all the heaps—namely $\ 7\ $ in this case.

You have misunderstood what the Wikipedia page is saying. There's no shame in that, though, since it's not particularly well written. The numbers $\ n_1, n_2,\dots, n_k\ $, over which the page says to take the _mex_ aren't numbers of items in nim heaps, but the Grundy numbers of _the positions you can move to_ in the game $\ G'\ $. If $\ G'\ $ were your game of nim with three heaps of size seven, for instance, there are effectively seven positions you can move to—two heaps of size seven, and one heap of any size from zero to six. The Grundy numbers of these positions are $\ 0,1,2,3,4,5,6\ $, so the _mex_ of these numbers, namely $7$, is the Grundy number of the position you're facing.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 8990901a2d6ca15d518ddf81d3b6441f