On the origins of chess

According to legend, chess was invented by Grand Vizier Sissa Ben Dahir, and given as a gift to King Shirham of India. The king was so delighted that he offered him any reward he requested, provided that it sounded reasonable. The Grand Vizier requested the following: "Just one grain of wheat on the first square of a chessboard. Then put two on the second square, four on the next, then eight, and continue, doubling the number of grains on each successive square, until every square on the chessboard is reached."

grains on chessboard

Intuitively, King Shirham — just like almost anybody else — underestimated the number of grains and laughed at Sissa because he had asked such a small gift. When he had someone to calculate the total number of grains, it took more than a week before he came back with the solution. King Shirham undoubtedly became very pale when he got the answer: the aggregated number of grains on all squares of a chessboard would be 18.446.744.073.709.551.615 grains. This is the harvest of all the wheat of the world1, of several decades.

The story contains an important lesson: people are psychologically bad at dealing with exponential growth2. Exponential growth shows an early stage of inertia during which it does not catch the eye. But suddenly, completely unexpected, it shows up like a tsunami, flooding everything and everyone.

The growth of the world population3 shows the same kind of pattern. It took a few hundred thousand years before the world had one billion people, soon after the year 1800. Only some hundred years later, in 1927, we were already two billion. Barely 46 years later, those two billion already had doubled. In July 1987, we reached the milestone of five billion. Twelve years later there was another billion people added. The seventh billion has been reached somewhere during the spring of 2012. Each day, we welcome 216,000 newborns, about the population of Ghent4.

Assignment

In the first chapter of his book A Short History on Nearly Everything5 author Bill Bryson makes an attempt to get a picture about the sheer size of some things like the universe. In this task, we will try to do the same for the number of grains of wheat that fit the chessboard of king Shirham after he has followed the instructions given by Sissa.

Write a program that outputs the answer to the following questions (the program does not need any input to compute the answers). Each answer is given as an integer (if the answer is a read-valued number, its decimal digits should be omitted), possibly followed by an indication of the units being used.

  1. Write the total number of grains of wheat that fit on the chessboard of King Shirham according to the instructions of Sissa. The answer to this question has already been given in the above text, but try to have this number calculated by your program.

  2. Write the total weight (in kilograms) of all these grains of wheat, if we assume that a single grains weighs 25 mg. Note that this weight has the same order of magnitude as the mass of Mount Everest6.

  3. If we assume that a grain of wheat is 5 mm long, what is the total distance (in kilometers) that we obtain when we put all grains on the chessboard one after the other. Alpha Centauri7, the closest star to our solar system, is located at 4.36 light years from Earth. The total length of the grains of wheat sufficiently covers the distance from Earth to this star, and back.

  4. The total surface of Belgium8 is 30.528 km2. If we consider the volume taken up by a grain of wheat as a cube with edges of 5 mm, how high is the stack if we completely cover Belgium with the grains of wheat on the chessboard of king Shirham?

Output

The output of your program should look like the one shown below. In order not to give away the answers, we only show the first and last digit of each answer. Do not forget to write out the unit, separated from the number by a space.

1...5
4...8 kg
9...7 km
7...5 m
Sign in to test your solution.
You can submit as many times as you want. Only your last submission is taken into account.
Sign in to test your solution.