Long long ago in an ancient land, there lived a very wise man who happened to be the Vizier at the court of a great Sultan.
Months and years passed by and the great Sultan died, and his young prince replaced him. Being young, the prince lacked experience. He started spending more than what his father used to. The wise Vizier decided to teach the brash prince a lesson!
The prince set a contest and as a reward, decided to give the winner whatever he wishes, boasting of his wealth, being under the illusion that his wealth is virtually endless. The Vizier won, and asked the prince for the prize: a single grain of wheat and a chessboard!
"What?! Just a grain of wheat! Are you insulting my wealth?" yelled the prince.
"No! Your majesty!" The Vizier explained. "You have to promise to double that grain of wheat until the chessboard is full, so on the first day you give me one grain of wheat on the first square of the chessboard, on the second day you double it on the second square (giv-ing me two grains), on the third, you double that on the third square (giving me four grains), and so on, until the sixty fourth square on the chessboard."
"I would have thought you being so smart", the young prince said. "You would ask for something more substantial. Anyway, if this is your wish I will grant you that."
And so, on the second day, the Vizier got 2 grains, on the third, he got 4 grains, and the young prince couldn't help himself making fun of the Vizier.
By the sixth day, the Vizier got 32 grains of wheat. By the eighth day and the end of the first row, he got a mere 128 grains. By the sixteenth day and the end of the second row, he got 32,768 grains.
Where was this leading to? Was it worth it for the Vizier?
By the end of the game (it was a mind game, wasn't it?) can you guess how many grains the Vizier would get in all?
The prince could not provide enough grains to give the Vizier a chessboard's worth of grains. Why? Study the progress of the number of grains on the individual squares and the corresponding running total in the table below. There are not enough grains in the whole world to give the Vizier the sum of 18,446,744,073,709,551,615 grains! Indeed, that many grains would cover the entire earth several inches deep.
Square | Grains on Square | Running Total |
1 | 1 | 1 |
2 | 2 | 3 |
3 | 4 | 7 |
4 | 8 | 15 |
5 | 16 | 31 |
6 | 32 | 63 |
7 | 64 | 127 |
8 | 128 | 255 |
9 | 256 | 511 |
10 | 512 | 1,023 |
11 | 1,024 | 2,047 |
12 | 2,048 | 4,095 |
13 | 4,096 | 8,191 |
14 | 8,192 | 16,383 |
15 | 16,384 | 32,767 |
16 | 32,768 | 65,535 |
17 | 65,536 | 131,071 |
18 | 131,072 | 262,143 |
19 | 262,144 | 524,287 |
20 | 524,288 | 1,048,575 |
21 | 1,048,576 | 2,097,151 |
22 | 2,087,152 | 4,194,303 |
23 | 2,097,152 | 8,388,607 |
24 | 8,388,608 | 16,777,215 |
25 | 16,777,216 | 33,554,431 |
26 | 33,554,432 | 67,108,863 |
27 | 67,108,864 | 134,217,727 |
28 | 134,217,728 | 268,435,455 |
29 | 268,435,456 | 536,870,911 |
30 | 536,870,912 | 1,073,741,823 |
31 | 1,073,741,824 | 2,147,483,647 |
32 | 2,147,483,648 | 4,294,967,295 |
33 | 4,294,967,296 | 8,589,934,591 |
34 | 8,589,934,592 | 17,179,869,183 |
35 | 17,179,869,184 | 34,359,738,367 |
36 | 34,359,738,368 | 68,719,476,735 |
37 | 68,719,476,736 | 137,438,953,471 |
38 | 137,438,953,472 | 274,877,906,943 |
39 | 274,877,906,944 | 549,755,813,887 |
40 | 549,755,813,888 | 1,099,511,627,775 |
41 | 1,099,511,627,776 | 2,199,023,255,551 |
42 | 2,199,023,255,552 | 4,398,046,511,103 |
43 | 4,398,046,511,104 | 8,796,093,022,207 |
44 | 8,796,093,022,208 | 17,592,186,044,415 |
45 | 17,592,186,044,416 | 35,184,372,088,831 |
46 | 35,184,372,088,832 | 70,368,744,177,663 |
47 | 70,368,744,177,664 | 140,737,488,355,327 |
48 | 140,737,488,355,328 | 281,474,976,710,655 |
49 | 281,474,976,710,656 | 562,949,953,421,311 |
50 | 562,949,953,421,312 | 1,125,899,906,842,623 |
51 | 1,125,899,906,842,624 | 2,251,799,813,685,247 |
52 | 2,251,799,813,685,248 | 4,503,599,627,370,495 |
53 | 4,503,599,627,370,496 | 9,007,199,254,740,991 |
54 | 9,007,199,254,740,992 | 18,014,398,509,481,983 |
55 | 18,014,398,509,481,984 | 36,028,797,018,963,967 |
56 | 36,028,797,018,963,968 | 72,057,594,037,927,935 |
57 | 72,057,594,037,927,936 | 144,115,188,075,855,871 |
58 | 144,115,188,075,855,872 | 288,230,376,151,711,743 |
59 | 288,230,376,151,711,744 | 576,460,752,303,423,487 |
60 | 576,460,752,303,423,488 | 1,152,921,504,606,846,975 |
61 | 1,152,921,504,606,846,976 | 2,305,843,009,213,693,951 |
62 | 2,305,843,009,213,693,952 | 4,611,686,018,427,387,903 |
63 | 4,611,686,018,427,387,904 | 9,223,372,036,854,775,807 |
64 | 9,223,372,036,854,775,808 | 18,446,744,073,709,551,615 |