The Wheat and Chessboard Problem: The Legend and the Math
One grain on the first square, doubled on each of 64 squares, adds up to 2^64 − 1: about 18.4 quintillion grains. See the legend, the math and the answer.
The wheat and chessboard problem asks how much grain you get if you put one grain on the first square of a chessboard, two on the second, four on the third, and keep doubling until the 64th square. The answer is 2⁶⁴ − 1 = 18,446,744,073,709,551,615 grains, about 18.4 quintillion. That much wheat would weigh around 1.2 trillion metric tons, more than 1,400 times the world's entire yearly wheat harvest.
The puzzle comes with a famous story about the invention of chess. This page tells the legend (and why it is a legend, not history), works through the math step by step, and gives a few ways to use the problem in a classroom.
The legend of the wheat and the chessboard
Please read this part as a story. Nobody knows who invented chess, and there is no evidence that this conversation ever happened.
In the most common version, a wise man (often called Sissa, a minister at the court of an Indian king) invents chess and presents it to his ruler. The delighted king offers him any reward he wants. Sissa asks for something that sounds modest: one grain of wheat on the first square of the board, two on the second, four on the third, and so on, doubling each time across all 64 squares.
The king laughs at such a small request and orders his treasurers to pay. Days later they return with bad news: there is not enough wheat in the kingdom, or in the whole world, to fill the board. Depending on who tells the story, Sissa is made a high advisor for his cleverness or punished for embarrassing the king.
The oldest known written version is from 1256, by the Arab historian Ibn Khallikan, centuries after chess appeared. Other tellings use rice instead of wheat; one well-known version from Kerala in southern India has a king playing chess against the god Krishna in disguise and paying his debt in rice over many years. For what is actually known about where chess came from, read our history of chess.
How many grains of wheat are on a chessboard?
Square number n holds 2ⁿ⁻¹ grains, because the first square has 1 (2⁰) and each square doubles the one before it:
- Square 1: 1 grain
- Square 2: 2 grains
- Square 3: 4 grains
- Square 8 (the end of the first row): 128 grains, and the whole first row adds up to 255
- Square 21: 1,048,576 grains, the first square with more than a million
- Square 31: 1,073,741,824 grains, more than a billion
- Square 64: 2⁶³ = 9,223,372,036,854,775,808 grains, about 9.2 quintillion
Adding all 64 squares gives 18,446,744,073,709,551,615 grains, which is exactly 2⁶⁴ − 1.
Why the total is 2^64 − 1
There is a neat trick that works for any doubling sum. Call the total S:
- S = 1 + 2 + 4 + … + 2⁶³
- Doubling every term gives 2S = 2 + 4 + 8 + … + 2⁶⁴
- Subtract the first line from the second. Every term cancels except 2⁶⁴ at the end of the second line and the 1 at the start of the first, so S = 2⁶⁴ − 1.
You can check the pattern on small boards. One square holds 1 grain (2¹ − 1), two squares hold 1 + 2 = 3 (2² − 1), three squares hold 1 + 2 + 4 = 7 (2³ − 1). The total is always one less than the next square. That is also why the last square alone holds more grains than all 63 squares before it put together.
How much would all that wheat weigh?
A grain of wheat weighs roughly 65 milligrams (estimates range from about 50 to 65 mg depending on the variety). With 65 mg per grain:
- The whole board: about 1,200,000,000,000 metric tons, or 1.2 trillion tons.
- The world's yearly wheat harvest: roughly 800 million metric tons in recent years.
- So the board holds more than 1,400 years of world wheat production at today's rate.
The first half of the board is a different story. Squares 1 to 32 hold 2³² − 1 = 4,294,967,295 grains, about 279 metric tons: a lot for one person, but easily paid by a kingdom. All the trouble is in the second half.
What is the "second half of the chessboard"?
The inventor and author Ray Kurzweil used the phrase in his 1999 book The Age of Spiritual Machines. His point: in the first half of the board, doubling feels manageable, but in the second half the numbers become so large that they change everything. People now use "the second half of the chessboard" for any technology that grows exponentially, such as computer chips, where steady doubling suddenly has a huge effect.
The first square of the second half (square 33, with 4,294,967,296 grains) holds one more grain than the entire first half.
Using the wheat problem in class
The legend is a favorite in math lessons because students can feel exponential growth:
- Count it out. Give groups a bag of rice and ask them to fill the squares of a printable board. Most groups give up around square 10 to 12, which has 512 to 2,048 grains.
- Predict first. Ask for a guess of the total before doing any math. Almost everyone guesses far too low.
- Compare with other chess numbers. The board has 204 squares of all sizes, 32 pieces and about 10¹²⁰ possible games, a number that makes even 2⁶⁴ look small.
More classroom ideas are in our chess lesson plans.
Sources
- Total, weight estimate, Ibn Khallikan (1256) and Kurzweil's "second half of the chessboard": Wikipedia, "Wheat and chessboard problem". en.wikipedia.org/wiki/Wheat_and_chessboard_problem.
- World wheat production of roughly 800 million metric tons a year: the yearly figures cited in the same article (about 781 million tons in 2019 and a forecast of about 842 million for 2025/26).
- All powers of two and sums computed exactly.
Frequently asked questions
How many grains of wheat are on a chessboard in total?
18,446,744,073,709,551,615 grains, which is 2⁶⁴ − 1, or about 18.4 quintillion. Square 64 alone holds 2⁶³, about 9.2 quintillion grains.
Is the wheat and chessboard story true?
No, it is a legend. The oldest known written version dates from 1256, centuries after chess was invented, and nobody knows who invented the game. The story survives because it is a perfect way to explain exponential growth.
How many grains are on the 64th square?
2⁶³ = 9,223,372,036,854,775,808 grains. That is one more than all of the other 63 squares combined.
What is the formula for the wheat and chessboard problem?
Square n holds 2ⁿ⁻¹ grains, and the first n squares hold 2ⁿ − 1 grains in total. For the full board, n = 64, so the total is 2⁶⁴ − 1.
Was it rice or wheat on the chessboard?
Both versions are told. Most English sources use wheat; versions from India and other parts of Asia often use rice. The numbers are the same either way, only the weight changes.
Keep learning
Related guides
- How Many Squares Are on a Chessboard? (64 or 204?) — A chessboard has 64 squares (8×8), but 204 if you count every square of every size. See the math, the 1,296 rectangles and an interactive board.
- History of Chess: Who Invented Chess and When? — Who invented chess, and when? No single inventor is known: chess grew from chaturanga in India around the 6th century. A short, fact-checked history.
- How Many Possible Chess Games Are There? (The Shannon Number) — There are about 10¹²⁰ possible chess games (the Shannon number) but only about 4.8×10⁴⁴ legal positions. See where the numbers come from, move by move.
- How Many Pieces Are in Chess? 32, and Here Is the Full List — A chess set has 32 pieces, 16 per player: 8 pawns, 2 rooks, 2 knights, 2 bishops, 1 queen and 1 king. See the full list, setup and fun facts, free.
- Free Chess Lesson Plans for Teachers (8 Weeks, K–8) — Free 8-week chess lesson plans for K–8 teachers: warm-ups, lessons, games, exit tickets and tips by grade, linked to free interactive lessons.