Grains so far
On this square
Weight
World harvest time
Heap height
View
Playback

More information about the wheat and chessboard problem

Wheat and chessboard: one grain, doubled on every square

A wise man invents chess for his king and asks for a modest reward: one grain of wheat on the first square, two on the second, four on the third, and twice as many on every square as on the one before. The king laughs, until his granaries turn out to be far too small. Watch the board fill square by square, from a few loose grains to heaps as tall as a car, a house, the Eiffel Tower and in the end a mountain, and see the doubling climb past a sack, a truckload and a ship to 18,446,744,073,709,551,615 grains: some 830 billion tonnes, more than a thousand years of the world's wheat harvest. An old legend tells of a wise man who invented chess for his king. Delighted, the king let him name his reward, and the inventor asked for nothing but grain: one grain of wheat on the first square of the board, two on the second, four on the third, and on every square twice as many as on the square before. The king laughed at so modest a wish and told his servants to bring a sack. Press Play and watch the board fill from a1 along the first row and up to h8. The first squares hold a few loose grains. From the eighth square on, each square shows its heap from the side, beside something of about the same height drawn to the same scale: a coin, an egg, a mug, a football, a dog, a car, a person, a bus, a house, a lighthouse, the Leaning Tower of Pisa, the Statue of Liberty, the Great Pyramid, the Eiffel Tower, the Burj Khalifa and at last the Matterhorn. The scale beside the board climbs with every square, past a kilogram bag, a sack, a truckload and a bulk carrier. Halfway, on square 32, the whole board so far holds about 193 tonnes of wheat: a lot, but a king could pay it. Then the doubling takes over. Square 54 alone brings the board past the wheat the whole world grows in a year, the bar turns red, and the last square holds 2⁶³, about 9.2 × 10¹⁸ grains. The whole board holds 2⁶⁴ − 1 = 18,446,744,073,709,551,615 grains: some 830 billion tonnes, more than a thousand years of the world's harvest, a heap 6 km high. Try rice instead of wheat, pick an example, or click a square to fill the board up to it. Step and Back move one square. Save image, record a video with the trickle of the grains, or open the picture in the photo editor with the pencil, where the board, the coordinates, every square's grains and every part of the scale are layers of their own.

How it works

  1. Press Play: the board fills from a1 along the first row and up to h8, one grain on the first square, two on the second, four on the third, and twice as many on every square after.
  2. Watch the first squares fill with loose grains; from the eighth square on, each square's heap rises beside something of about its height, from a coin and a mug to a car, a bus, the Eiffel Tower and the Matterhorn, with its number of grains.
  3. Follow the scale beside the board: the grains so far climb past a kilogram bag, a sack, a truckload and a bulk carrier, and on square 54 past the wheat the whole world grows in a year.
  4. Try rice instead of wheat, pick an example such as half the board or a truckload, or click a square to fill the board up to it, and read the weight, the world harvest time and the height of the heap in the tiles.

The legend of the grains on the chessboard

The story is old and told in many ways. A wise man, often called Sessa, invents the game of chess and presents it to his king, an Indian or Persian ruler. The king is so pleased that he lets the inventor name his reward. The inventor asks only for grain: one grain of wheat (or rice) on the first square of the board, two on the second, four on the third, eight on the fourth, and so on, doubling on every square up to the sixty-fourth. The king laughs at so modest a request and orders a sack of grain. But when his treasurers do the sums, they find that all the granaries of the kingdom, and of the whole world, could not pay it. The oldest written version is by the historian Ibn Khallikan in 1256, and Dante used the doubling of the chessboard to describe the countless angels of heaven.

Why it adds up to 2⁶⁴ − 1

Square k holds 2^(k−1) grains: 1, 2, 4, 8, 16 and so on, up to 2⁶³ = 9,223,372,036,854,775,808 on the last square. Add up the squares and something neat happens: 1 + 2 = 3, 1 + 2 + 4 = 7, 1 + 2 + 4 + 8 = 15, always one less than the next power of two. So the first k squares hold 2^k − 1 grains, and every square holds one grain more than all the squares before it together. The whole board holds 2⁶⁴ − 1 = 18,446,744,073,709,551,615 grains, which is also the largest number a 64-bit computer word can hold. Sums like this, where each term is the one before times a fixed factor, are called geometric series.

How much wheat is that?

A grain of wheat weighs about 45 milligrams. The first row of eight squares holds 255 grains, about 11 grams: a small handful. Half the board, 32 squares, holds 4,294,967,295 grains, about 193 tonnes, about eight truckloads, which a king could still pay. But each further square doubles the total. By square 54 the board holds more wheat than the whole world harvests in a year, about 800 million tonnes. The whole board comes to some 830 billion tonnes, more than a thousand years of the world's wheat. Poured into one heap it would stand about 6 kilometres high and 25 kilometres across.

The second half of the chessboard

The story is a lesson about doubling. In the first half of the board the numbers grow fast but stay within reach; in the second half they leave every everyday scale behind. The inventor and futurist Ray Kurzweil called this the second half of the chessboard: anything that keeps doubling, such as the transistors on a chip, a population, an investment at compound interest or a virus spreading early in an epidemic, looks harmless for a long time and then overwhelms everything. Something that grows 7 % a year doubles about every ten years; ten doublings make it about a thousand times as large, twenty about a million.

Frequently asked questions

How many grains are on a chessboard in the legend?

18,446,744,073,709,551,615, which is 2⁶⁴ − 1. The first square holds 1 grain and every next square twice as many, so square k holds 2^(k−1) grains and the last square alone holds 2⁶³ = 9,223,372,036,854,775,808. The squares add up to one less than the next power of two.

How much would all that wheat weigh?

At about 45 milligrams a grain, roughly 830 billion tonnes. The world harvests about 800 million tonnes of wheat a year, so it would take more than a thousand years of the whole world's harvest. In rice, at about 20 milligrams a grain, it is still some 370 billion tonnes, about 700 years of the world's rice.

Why does each square hold more than all the squares before it?

Because 1 + 2 + 4 + … + 2^(k−1) = 2^k − 1. The squares before square k + 1 together hold 2^k − 1 grains, and square k + 1 holds 2^k, exactly one grain more. That is what makes doubling so fast: every step adds more than everything that came before.

When does the board pass a year of the world's harvest?

On square 54. After 53 squares the board holds about 9 × 10¹⁵ grains of wheat, around 400 million tonnes; square 54 doubles that to about 1.8 × 10¹⁶ grains, roughly the 800 million tonnes the world grows in a year. The ten squares after it multiply the total by another thousand.

Is the story true?

Nobody knows who invented chess, and the story is a legend. It is told with wheat or rice, of an inventor often called Sessa and a king of India or Persia, and in some versions the king makes the inventor his adviser while in others he punishes him for his cheek. Its first written form is in a work by Ibn Khallikan from 1256, and it has been used ever since to show how fast doubling grows.

Can I use the picture?

Yes. Save gives a PNG at the size you choose, Save JSON writes the grains on the last square and on the board so far to the last digit with their weight and heap, Record films the board filling with the trickle of the grains, and the pencil opens the picture in the PictorX photo editor with the board, the coordinates, every square's grains, the counts and the parts of the scale on layers of their own. In the editor itself it is under Apps ▸ Science ▸ Mathematics ▸ Wheat and Chessboard. Everything runs in your browser.

Wheat and Chessboard: how do I record a video?

Press the red Record button in the playback bar: it films what the stage shows. Press it again to stop, and the video is saved to your device. Recording is free; you only need to sign in. Without a subscription the video carries a small PictorX logo in a corner. The button beside Record opens the video options: the shape (as shown, square, story 9:16 or wide 16:9), the length (until you stop, or 5, 10, 15 or 30 seconds for social media) and the file: MP4, WebM or an animated GIF. For the sound, choose the app's own sounds or one of three music tracks: calm, bright or beat.

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

Go to Editor