Museum of Numbers

Computing Limits · Exhibit No. 3

2,147,483,647

The number where computers run out of room

In December 2014, a pop song did something no hacker had managed. It made the most famous video site in the world admit it had a problem with counting. The song was "Gangnam Style." The number it was racing towards was 2,147,483,647. It is one of the most important limits in modern computing - and it has quietly broken games, airline schedules and even aeroplanes.

A giant mechanical stadium scoreboard reading 2,147,483,64_ with the last digit mid-flip, a sea of tiny dancing figures below

↳ a party approaching a cliff edge

Section I

The video that watched the counter

PSY's "Gangnam Style" appeared on YouTube in July 2012. By December that year, it had become the first video ever to pass one billion views. It kept going.

By early December 2014, it was heading towards 2,147,483,647 views - the largest number YouTube's original view counter had been built to hold.

YouTube responded with a wink. In a post on Google+, it wrote:

"We never thought a video would be watched in numbers greater than a 32-bit integer (=2,147,483,647 views), but that was before we met PSY."

It announced that the counter had been upgraded to a far bigger one - and hovering over the view count made the digits spin wildly. In truth, YouTube's engineers had quietly made the upgrade months earlier. The "emergency" was an Easter egg.

But the limit was real. And a lot of other software has not been so lucky.

A laptop screen showing a music video with a spinning view counter, engineers grinning and holding a giant new counter
Section II

A prime found in the dark

Long before computers, this number already had a claim to fame.

In 1772, the great Swiss mathematician Leonhard Euler set out to check whether 2,147,483,647 was a prime - a number that cannot be divided evenly by anything except 1 and itself.

Euler was, by then, almost completely blind.

Checking by brute force would have meant trying thousands upon thousands of possible divisors. But Euler used clever reasoning to show that only a few hundred special candidates could possibly divide it. He checked them - and none did.

2,147,483,647 was prime.

He reported it in a letter to a member of the famous Bernoulli family of mathematicians. For nearly a century afterwards, it was the largest prime number anyone knew.

Candlelit illustration of Euler dictating to an assistant, a glowing scroll bearing 2,147,483,647

A number made of doubling

2,147,483,647 is what you get when you double 1 thirty-one times and subtract 1:

2³¹ − 1

Numbers of this shape are called Mersenne numbers, after the 17th-century French monk Marin Mersenne. The largest prime known today is one of them too.

A single grain of rice doubling across a row of squares, with a minus 1 at the end
Section III

Counting with only 0 and 1

So why did this 18th-century prime end up inside YouTube's counter? Because computers count differently from us.

We count with ten digits, 0 to 9. Computers count with just two: 0 and 1 - tiny switches that are either off or on. This is called binary.

In binary, each extra place is worth double the one before: 1, 2, 4, 8, 16, 32…

Many computers store an ordinary whole number in a box of 32 of these switches. One switch is used to say whether the number is positive or negative. That leaves 31 for the number itself.

Turn all 31 switches on, and you get the biggest number the box can hold:

1111111111111111111111111111111

which, added up, is 1 + 2 + 4 + 8 + … + 1,073,741,824 = 2,147,483,647.

That is 2³¹ − 1 - Euler's prime, hiding inside almost every computer on Earth.

A row of 32 light switches, the first red labelled plus-or-minus, the other 31 glowing gold, with doubling values above and a total of 2,147,483,647

↳ 32 switches - one for the sign, 31 for the number

A sum hiding in plain sight

Just like 5,050 is secretly 1 + 2 + 3 + … + 100, 2,147,483,647 is secretly 1 + 2 + 4 + 8 + … all the way up to 1,073,741,824 - thirty-one doublings added together.

A staircase where each step is twice as tall as the last, a nod to the 5050 staircase

Enjoying this story?

Enjoying this story?

NumberMuseum tells the stories behind remarkable numbers - the people, the accidents, and the surprises hiding inside them. Get the next one delivered to your inbox.

One new story a week, at most.

At most one email a week.

Section IV

What happens when you add one more?

Think of the mileage counter in an old car - the odometer.

If it has six digits, the highest it can show is 999,999. Drive one more mile, and every wheel rolls over at once. It does not say 1,000,000. It says 000,000. As far as the car knows, it is brand new.

Computers do the same thing, with a twist.

Add 1 to 2,147,483,647, and all the switches roll over - including the one that means "plus or minus." The number does not become 2,147,483,648.

It becomes −2,147,483,648.

The biggest positive number, plus one, turns into the biggest negative number. Programmers call this overflow.

Imagine a bank balance, a game score, or a timer suddenly jumping from over two billion to minus two billion. That is what overflow can do.

A car odometer rolling from 999,999 to 000,000, beside a computer odometer rolling from 2,147,483,647 to negative 2,147,483,648, a cartoon car looking startled

↳ the odometer rolls over - computers do exactly the same

Section V

When the numbers ran out

Overflow is not just a theory. Real systems have hit this wall.

An airliner that needed switching off.

In 2015, US aviation authorities warned that a Boeing 787 left powered on continuously for 248 days could lose all its main electrical power, because a software counter in its generator controls would overflow. Boeing found it in laboratory testing; the fix, until new software arrived, was to switch the planes off and on again regularly. And 248 days is a telling number. A counter that ticks 100 times a second reaches 2,147,483,647 after almost exactly 248.55 days.

An airline at Christmas.

In December 2004, the US regional airline Comair saw its crew-scheduling computer collapse during a winter storm. The system could only record a limited number of schedule changes in a month - reported as 32,768, the limit of a smaller, 16-bit counter. The storm forced so many changes that it hit the limit on Christmas Eve. Around 1,100 flights were cancelled and tens of thousands of passengers were stranded.

Games with a ceiling.

In many video games, 2,147,483,647 is the most gold, coins or points a player can hold. Push past it, and players sometimes see their fortune flip into a giant negative number.

Three panels: an airliner in a hangar with a 248-day calendar, a snowy departures board showing CANCELLED, a treasure chest overflowing with a negative score

A date to remember: 2038

Many computers count time as the number of seconds since the start of 1970. Stored in a 32-bit box, that count reaches 2,147,483,647 at exactly 03:14:07 UTC on 19 January 2038. One second later, old systems that have not been updated could think it is 1901. Engineers have been fixing this - quietly - for years.

A calendar page for 19 January 2038 with a clock reading 03:14:07 and a small spanner beside it
Section VI

Why not just use a bigger box?

Today, most new software does exactly that.

The next common size up is 64 switches instead of 32. Doubling the number of switches does not double the limit - it multiplies it by more than four billion.

The biggest number a 64-bit box can hold is 9,223,372,036,854,775,807 - over nine billion billion.

That is the kind of counter YouTube switched to. At that size, every person on Earth could watch "Gangnam Style" ten times a day, every day, for 300,000 years - about as long as our species has existed - and still not reach the top.

But every box, however big, has a top.

That is the bigger idea behind 2,147,483,647: computers do not really do infinity. Every number inside a machine lives in a box of fixed size, and somebody had to decide how big that box would be.

Most of the time, nobody notices. Until something - a song, a storm, a plane left switched on - counts a little too far.

Nesting boxes, each much larger than the last: a small 32-bit box overflowing with light, a vast 64-bit box with room to spare, and in the distance an even bigger box

↳ every box, however big, has a top

Section VII

Why we still remember it

Programmers recognise 2,147,483,647 at a glance. It turns up in error messages, bug reports and game glitches the world over.

It is remembered because it sits at the crossroads of two very different stories: a blind mathematician in 1772, proving it was prime by pure thought - and the modern world, where it became the invisible ceiling inside billions of machines.

It is a reminder that computers are not magic. They are extremely fast counters, working inside limits that humans chose.

On one side Euler's candlelit desk with 2,147,483,647 on a scroll; on the other a glowing data centre with the number on screen; a line of 31 glowing ones connecting them
The Exhibit Label

2,147,483,647 in a nutshell

Here is why 2,147,483,647 matters:

  • It is 2³¹ − 1: the largest number that fits in a standard signed 32-bit computer integer.

  • Add 1, and it overflows to −2,147,483,648, like an odometer rolling over.

  • In 1772, a nearly blind Leonhard Euler proved it is prime; it stayed the largest known prime for nearly a century.

  • In 2014, "Gangnam Style" approached it on YouTube, which joked about upgrading to a 64-bit counter.

  • A Boeing 787 counter would overflow after 248 days of continuous power.

  • Many systems that count seconds from 1970 will reach it on 19 January 2038.

A final illustrated broadsheet combining the spinning counter, Euler's scroll, 31 glowing switches, the rolling odometer, the airliner, the Christmas departures board and the 2038 calendar

Not a crash. Not a hack. Just one more than the box could hold.

Sometimes a computer fails simply because it has run out of numbers.

- The Oddly Specific Numbers Desk

Keep wandering

There are more exhibits in the cabinet.

No syllabus. No order required. Pull open whichever drawer looks most interesting.

Mathematical Curiosities

1729

The smallest number expressible as the sum of two cubes in two different ways. Hardy and Ramanujan were both in the room.

Read

Mathematical Curiosities

5,050

The sum of all whole numbers from 1 to 100. A schoolboy's shortcut that has outlasted the lesson.

Read

Mathematical Curiosities

6,174

Take any four-digit number, rearrange its digits, subtract, and repeat. You will always end up here.

Read

Powered by DollarPageClub