# Rice on a Chessboard - Exponential Numbers

• Author:
• Updated date:

I am a former maths teacher and owner of DoingMaths. I love writing about maths, its applications and fun mathematical facts.

## Rice on a Chessboard - An Exponential Story

This is a story about a chessboard, a game of chess and the incredible power of exponential numbers.

## Ambalappuzha Sri Krishna Temple

At the Ambalappuzha Sri Krishna Temple in South India is a Hindu temple built some time during the 15th-17th century which today has a very curious tradition, with an even more curious story behind it.

All pilgrims to the temple are served a dish known as paal payasam, a sweet pudding made of rice and milk. But why? The tradition has some very mathematical origins.

## The Legend of Payasam at Ambalappuzha

Once upon a time, the king who ruled over the region of Ambalappuzha was visited by a travelling sage, who challenged the king to a game of chess. The king was well known for his love of chess and so he readily accepted the challenge.

Before the game started, the king asked the sage what he would like as a prize if he won. The sage, being a travelling man with little need for fine gifts, asked for some rice, which was to be counted out in the following way:

Give me one grain of rice on the first square of this chessboard, then two grains on the second square, four grains on the third square, eight grains on the fourth square and so on, so that each square contains double the amount of rice of the previous square.

Now the king was taken aback by this. He had expected for the sage to request gold or treasures or any of the other fine things at his disposal, not just a few handfuls of rice. He asked the sage to add other things to his potential prize, but the sage declined. All he wanted was the rice.

So the king agreed and the chess game was played. The king lost and so, being true to his word, the king told his courtiers to collect some rice so that the sage's prize could be counted out.

The rice arrived and the king started counting it out onto the chess board; one grain on the first square, two grains on the second square, four grains on the third square and so on. He completed the top row, putting 128 grains of rice on the eighth square.

He then moved onto the second row; 256 grains on the ninth square, 512 on the the tenth square, then 1024, then 2048, doubling each time until he needed to put 32 768 grains of rice on the last square of the second row.

The king now started to realise that something was amiss. This was going to cost more rice than he had originally thought and there was no way he would be able to fit it all onto the chessboard, but he continued counting. By the end of the third row, the king would have needed to put 8.4 million grains of rice down. By the end of the fourth row, 2.1 billion grains were needed. The king brought his best mathematicians in, who calculated that the final square of the chessboard would require more than 9 x 10^18 grains of rice (9 followed by 18 zeroes) and that in total the king would be required to give 18 446 744 073 709 551 615 grains to the sage.

## The first four rows of the chessboard

Scroll to Continue

## Read More From Owlcation

It was at this point that the sage revealed himself to be the God Krishna in disguise. He told the king that he did not have to pay him his prize all in one go, but instead could pay it over time. The king agreed to this and that is why to this day, pilgrims to the Ambalapuzzha temple are served paal payasam as the king continues to pay his debt.

The total number of grains of rice needed to fill the chessboard would have been 18 446 744 073 709 551 615. This is more than 18 quintillion grains of rice which would weigh approximately 210 billion tonnes and would be enough rice to cover the entire country of India with a metre high layer of rice.

To put this into perspective, India currently grows approximately 100 million tonnes of rice per year. At this rate it would take over 2 000 years to grow enough rice to pay the kings debt.

## The Maths Part

In case you were wondering how the numbers in this article were calculated, here's the maths part.

The number of grains of rice on each square follows the following pattern; 1, 2, 4, 8, 16, 32, 64 etc. These are the powers of two (2 = 2, 4 = 2 x 2, 8 = 2 x 2 x 2 etc). With a little closer investigation we can see that the first square is 2^0, the second square is 2^1, the third square is 2^2 and so, giving us an nth term of 2^(n-1). This means that for any particular square on the chessboard, we can work out how much rice is needed by doing two to the power of one less than the square's position. E.g. the 20th square contains 2^(20 - 1) grains of rice which equals 524 288.

To work out how many grains are needed in total, we could work out each square and add all 64 squares together. This would work, but would take a very long time. The quicker way is by making use of the following quirk of powers of two. Starting at the beginning, if you add consecutive powers of two together, you will notice that your total is always one short of the next power of two. E.g. the first three powers of two, 1+2+4 = 7 which is one below the next power, 8. 1+2+4+8 = 15 which is one below the next power 16. This can be proven to be true for all powers of two and by using this we get that the total number of grains on the chessboard is (2^64)-1 which gives the total quoted above.

David (author) from West Midlands, England on July 28, 2020:

I like your point. I'd never thought of it like that before. I have written another article calculating the number of squares on a chessboard (https://hubpages.com/stem/How-Many-Squares-are-on-... but bringing the two together is an interesting idea.

Raghavendra Rao Gudipudi on July 25, 2020:

Small Correction

Your answer underestimates. The direct squares are 64. But keep adding ...four boxes (2*2) is a square. Look at all the new squares consisting of 4 boxes. Similalrly 9 boxes (3*3) is also a square...till the complete chess board is also a square. Also remember, there is no comment that the boxes cannot overlap while calculating a square.

This is a very complex problem. Not as trivial as doing 2^64-1. The biggest challenge is calculating the number of unique squares..

Only then you get the correct number of grains...

Raghavendra Rao Gudipudi on July 25, 2020:

Your answer underestimates. The direct squares are 64. But keep adding ...four boxes is a square. Look at all the new squares consisting of 4 boxes. Similalrly 6 boxes is also a square...till the complete chess board is also a square. Only then you get the correct number of grains...