The legend of the chessboard

chessboardThe story tells us that long long ago the great Sultan of India loved to play games. As he started to get bored of the games that were present at the time he asked a wise man who lived in his kingdom to come up with a new game.

This, according to the legend, is how the game of chess was invented. The Sultan was very pleased with the wise man who had invented the game and in return he offered the wise man a reward of his own choosing.

riceTo the Sultan’s surprise, the wise man did not ask for any gold. Instead he only had one request: He asked just for a few grains of rice in the following manner: the sultan was to put a single grain of rice on the first chess square, two grains on the second square, four on the third square and carry on doubling this number on every consequent square to fill up all 64 squares of the chessboard.

This seemed to the ruler to be a modest request, so he called for his servants to bring the rice. Did the Sultan manage to fulfil the wise man’s request?

Python Code


Your task consists of writing a python script to calculate the total number of grains of rice required to cover the chessboard following’s the wise man’s request.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 3.9 / 5. Vote count: 24

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: ,