Monday 17 May 2010

puzzle



This is an old puzzle. I was given it in a maths lesson when I was 12. The teacher had a comb-over and died of a heart attack at 64. I would try and do the puzzle on paper, but could never get the answer right. Then computers came along ;-) It still intrigues me.

A man did a favour for a king. The king asked the man to choose his reward. The man asked for a grain of rice to be placed on the first square of a chessboard. He asked for this to be doubled on the second and all subsequent squares. How many grains of rice did he end up with?


1
2
4
8
16
32
64
128

256
512
1,024
2,048
4,096
8,192
16,384
32,768

65,536
131,072
262,144
524,288
1,048,576
2,097,152
4,194,304
8,388,608

16,777,216
33,554,432
67,108,864
134,217,728
268,435,456
536,870,912
1,073,741,824
2,147,483,648

4,294,967,296
8,589,934,592
17,179,869,184
34,359,738,368
68,719,476,736
137,438,953,472
274,877,906,944
549,755,813,888

1,099,511,627,776
2,199,023,255,552
4,398,046,511,104
8,796,093,022,208
17,592,186,044,416
35,184,372,088,832
70,368,744,177,664
140,737,488,355,328

281,474,976,710,656
562,949,953,421,312
1,125,899,906,842,624
2,251,799,813,685,248
4,503,599,627,370,496
9,007,199,254,740,992
18,014,398,509,481,984
36,028,797,018,963,968

72,057,594,037,927,936
144,115,188,075,855,872
288,230,376,151,711,744
576,460,752,303,423,488
1,152,921,504,606,846,976
2,305,843,009,213,693,953
4,611,686,018,427,387,904
9,223,372,036,854,775,808
 
The Answer: 18,446,744,073,709,551,616

Today I learnt... computers don't know everything (I already knew that :) - Excel will only show values up to 15 numbers - after that it substitutes zeros! From the 51st square I had to go manual.