# The unknown wheat-and-chessboard problem

You can read the original story of the Wheat and Chessboard problem on Wikipedia. (But you won't get anything useful from it :))

An eternity after the original creation of chess, a score of Swedish men re-invented the game, which was laid out in the warped space of the 378547252nd dimension, and has been known as the game Chess 378547252. The board of Chess 378547252 was so large, that no one was able to count how many cells (in the grid) there were.

The same old king, however, was delighted to find it enjoyable, and decided to award the creator(s) of Chess 378547252 whatever they wanted.

- O, lord. Please, allow us to humbly request the smallest prize, of one grain in the first cell, two grains in the second cell, four grains in the third cell, and twice as many grains in each cell as that in the previous cell thereafter.

- You greedy men! I will have given you 18,446,744,073,709,551,615 grains, two thousand times as much as the annual total production in the world, after only the first 64 cells! And look, there are so many cells ahead. Do you think I'm a fool?

- No, lord. No. Please calculate this carefully: If we are given ONE EXTRA grain, we will have been awarded nothing at all!

The king looked at the formulae, verified it a thousand times so as to be absolutely sure it's correct, and finally admitted that the men were right. In addition, the king decided to give the extra grain than the men originally asked for:

- Take this last grain, and you have zero with you. Now get out of here fast!

No one ever since has known how the story continued, and scientists have worked hard its legitimacy and truthness.

You, the smartest user from Puzzling SE, are here for the challenge.

• How many grains were the men awarded, before the last one?
• Can you find out how is the story sensible?
• Shouldn't the men be giving a grain to the king at the end, rather than the other way around? If they haven't actually gotten their reward, then they've gained one grain rather than lost one. – Deusovi Nov 8 '20 at 18:40
• @Deusovi I can assure you that there's nothing wrong with that part. (I probably should have added lateral-thinking at first) – iBug Nov 8 '20 at 18:42

This question seems to have a lot of possible solutions, likely dependent on subjective interpretation of the question. This answer gives some of them that I found.

They were awarded

-1 grains, of course! The issue is in figuring out how many cells there were, and how they could possibly get -1 from adding a lot of positive numbers.

There are several options. There could be:

infinitely many cells on the board:

The men might be summing the divergent series naively using the formula for sums of geometric series: the sum of $$1 + a + a^2 + \cdots$$ is $$\frac{1}{1-a}$$. (This comes from the calculation $$S = 1 + a·S$$, "factoring out an $$a$$" from all bit the first term of the sum.)
They could also be using analytic continuation, a method of "summing divergent series" that assigns the value -1 to the series $$1+2+4+8+\cdots$$.
Or perhaps the men are working in the 2-adic numbers, where "...111111₂" read as binary is a perfectly valid number, and this number is indeed equal to -1.

There could also be finitely many cells. The system they're working in may be an integer represented in a computer -- the byte 11111111 represents both 255 (when interpreted as an unsigned integer) and -1 (when interpreted as a signed integer). The latter representation exists because if you add 1 to it, you get a repeated carry that clears out all the bits in the byte (leaving you with an extra carry bit that gets discarded). We know that there are at least 64 squares, so this doesn't quite work, but it's possible that they're using a long int, which uses 8 more bits (or rather, a long long long [...] long int for some number of longs). In this case, they would have been requesting $$2^n - 1$$ grains, where $$n$$ is the number of bits in use.

• May I ask whether the addition of tag lateral-thinking helped? To confirm, the first one is the expected answer, as this part in the story hints: rot13(gung ab bar jnf noyr gb pbhag ubj znal pryyf gurer jrer). – iBug Nov 8 '20 at 18:51
• @iBug There are three different 'answers' in the first part. And the issue wasn't the lack of [lateral-thinking] - I was already writing this answer up at the time. The last 'gift' still seems to be the reverse of what it should be, because if the king gives them a grain then, they won't have 0 -- they'll have 1, and that's certainly not the amount they were asking for. (But there's also the issue of subjectivity. My answer has four possible options, and I'm sure there are more.) – Deusovi Nov 8 '20 at 18:56
• Pretty sure I've given more hints towards the intended answer (of infinity): The "strange" number 378547252 has exactly one Google result related to chess, and that also explains why the men are Swedish instead of of any other nationality. – iBug Nov 8 '20 at 19:04
• Anyways, very good finding the answer so quickly. I'll come back later for the green tick so others have a chance to give this puzzle a try. – iBug Nov 8 '20 at 19:05
• @iBug I have three separate answers under "infinity". – Deusovi Nov 8 '20 at 19:05