Taxicab Number Finder

Every sum of two cubes with two or more pairs.

  • Every pair listed
  • Up to 10^11
  • Cabtaxi option
A small rounded clay table with two groups of softly rounded clay cubes of matching total size and a soft clay arch between the groups, in daylight.

The guide

Counting 1729 honestly: which cubes are allowed, and what counts as a way

A taxicab number is the smallest number that is a sum of two positive cubes in n ways. Deciding what a way is, and which cubes may be used, changes every answer.

  • 1729 smallest sum of two positive cubes in two ways
  • 87,539,319 Ta(3), the smallest with three ways
  • 91 Cabtaxi(2): 3^3 + 4^3 = 6^3 - 5^3
  • 9,514,790 cube pairs enumerated up to 10^11 (counted here)
  • 13,966 numbers up to 10^11 with two or more ways (counted here)
Read the full guide Fold the guide 7 min · 12 sources

Take 1729. Cube 1 and 12 and the sum is 1 + 1,728. Cube 9 and 10 and the sum is 729 + 1,000. Two different pairs of cubes, one total.

The Wikipedia article on taxicab numbers tells the story. Around 1919 G. H. Hardy told Srinivasa Ramanujan that the number of his taxi, 1729, seemed dull. Ramanujan answered that it was the smallest number that is a sum of two cubes in two different ways. The remark made the number famous, and the article on 1729 calls it the first nontrivial taxicab number. The observation itself is older: the article credits Bernard Frenicle de Bessy with noting the two pairs in 1657.

A chatbot will usually stop there. It recalls 1729 and perhaps 87,539,319, and it quotes the larger values from memory with a digit wrong. This page does the work instead, and the work starts with two decisions that are easy to skip.

What counts as a way, and which cubes are allowed

The first decision is what a way is. Take 9 = 1 + 8, which is 1 cubed plus 2 cubed. Write the pair the other way round and 8 + 1 looks like a second route to the same total. If ordered pairs are counted, 9 would be the first number with two ways, long before 1729. Nobody means that.

A way is an unordered pair of cubes, so 1 and 8 together are one way, and 2 = 1 + 1 is one way as well. The tool counts pairs this way and keeps a check that fails if it ever does not: with ordered pairs, the first number with two ways comes out as 9.

The second decision is which cubes are allowed. The article defines the nth taxicab number, written Ta(n), as the smallest integer that is a sum of two positive integer cubes in n distinct ways. Ta(1) is 2, which is 1 + 1. Ta(2) is 1729. The word positive is doing real work, and the next section shows how much.

The same article says the restriction to positive summands is necessary, because allowing negative numbers allows more and smaller instances. The variant that allows them is called a cabtaxi number. The Cabtaxi page defines Cabtaxi(n) as the smallest positive integer that is a sum of two cubes in n ways when the cubes may be positive, negative or zero.

Here is a worked example you can reproduce by switching the tool to Cabtaxi. The number 91 is 27 + 64, which is 3 cubed plus 4 cubed. It is also 216 - 125, which is 6 cubed minus 5 cubed. So 91 already has two ways, and it is Cabtaxi(2), against 1729 for Ta(2).

The gap widens. OEIS A047696 lists 1, 91, 728, 2,741,256 and 6,017,193 for the first five cabtaxi numbers. The number 728 is 6 cubed plus 8 cubed, 9 cubed minus 1 cubed, and 12 cubed minus 10 cubed. Ta(3), by contrast, is 87,539,319. Allowing a negative cube makes the three-way answer about 120,000 times smaller.

Zero is a separate question. Cabtaxi(1) is 1, written as 1 cubed plus 0 cubed, and that needs a zero cube. This page leaves zero out. It changes nothing for two or more ways. A number with a zero cube is itself a cube, and Fermat’s Last Theorem, whose case for cubes was already known to Euler, says no cube is a sum of two positive cubes. A cube cannot have a second way.

The tool tests this directly. Up to one million, exactly 4,311 numbers are a sum of two positive cubes in exactly one way. Allowing zero would add the 100 perfect cubes in that range, and the count would be 4,411.

How a map from sums to pairs finds them

The method is short to state. For every pair a and b with a at most b and a cubed plus b cubed at most the limit, record the sum. A sum recorded twice has two pairs. A sum recorded three times is a three-way number. The tool keeps the pairs per sum, so every way is shown, and it adds each pair back at the end to prove the cubes sum to the number.

A hash map is the textbook way to hold the sums, but it is the wrong tool at this size. Up to 10^11 there are 9,514,790 pairs, counted by the page, and a map that holds every key and list at once grows with that whole count. So the page cuts the range of sums into segments of about two million, fills a typed array with the sums in one segment, sorts it with the built-in numeric sort and reads off runs of equal values. The buffer never holds more than one segment, so memory does not grow with the limit.

Exactness matters in a search like this. Every sum below the cap is far under 2 to the power 53, the point where ordinary numbers stop being exact, so the arrays hold them without rounding. Testing whether a number is a cube takes the browser’s Math.cbrt, which returns the cube root, followed by a correction of one up or down in exact whole-number arithmetic, because a rounded root can be off by one. For a single number up to 10^18 the page switches to BigInt, which MDN describes as the type for integer values too high or too low for the usual number type. A background worker does the heavy part, so the page stays responsive and offers a Cancel.

One regularity helps a reader check the output. OEIS A001235 notes that if n is a number that is a sum of two positive cubes in more than one way, then so is n times any cube. Since 1729 times 8 is 13,832, that number must appear in the list, and it does.

Why the cost grows as the limit to the power two thirds

How long does the search take as the limit rises? The pairs a and b with a cubed plus b cubed at most L are the whole-number points under the curve x cubed plus y cubed equals L. Both coordinates reach only the cube root of L, so the area of the region grows like L to the power two thirds. The number of pairs to enumerate does the same.

The counts bear this out. The page enumerates 441,521 pairs up to 10^9, then 2,049,798 up to 10^10, then 9,514,790 up to 10^11. Each tenfold step multiplies the work by about 4.64, which is 10 to the power two thirds. A search to 10^11 is therefore about 21.6 times the work of a search to 10^9, not 100 times.

The number of results grows more slowly than the number of pairs. This page and an independent Python program both count 43 numbers up to a million that are a sum of two positive cubes in two or more ways, then 1,554 up to 10^9, 4,724 up to 10^10 and 13,966 up to 10^11. Over that range the count rises roughly like the square root of the limit. That is an observation of these counts, not a theorem.

Three ways are far rarer. The first is Ta(3) = 87,539,319, which is 167 cubed plus 436 cubed, 228 cubed plus 423 cubed, and 255 cubed plus 414 cubed. Set the tool to a limit of 10^9 and three ways, and it lists eight numbers, starting with 87,539,319 and ending with 958,595,904. Up to 10^11 there are 78. None has four ways.

Why the large values are quoted

Ta(4) is 6,963,472,309,248. The Wikipedia article credits Rosenstiel, Dardis and Rosenstiel with finding it in 1989, after John Leech obtained Ta(3) in 1957. Ta(5), found by Dardis in 1994 and confirmed by David Wilson in 1999, is 48,988,659,276,962,496. Ta(6), above 24 sextillion, was announced in 2008, after a 2003 paper by Calude and colleagues gave a 99 percent probability that it was the right number. Only upper bounds are known for Ta(7) to Ta(12).

This page does not rediscover those. Reaching Ta(4) with the same method would mean about 160 million pairs, scaling the measured count by the two thirds power, and the page stops at 10^11. So for Ta(4) and above it quotes the published values and adds every listed pair back in exact arithmetic. For Ta(4) and Ta(5) it also runs the one-number search on the quoted value and gets exactly the quoted pairs, four for Ta(4) and five for Ta(5).

That is worth being careful about. Finding exactly four ways for 6,963,472,309,248 shows the pairs are right. It does not show that nothing smaller has four ways. Minimality is the hard part, and the page does not claim it beyond its own search. It does confirm 1729 and 87,539,319 as the smallest with two and three ways, because both lie below its cap.

What the tool cannot do

It handles sums of exactly two cubes. Sums of three or more cubes are another problem, and so are other powers. The article on generalized taxicab numbers writes Taxicab(k, j, n) for the smallest number that is a sum of j powers of degree k in n ways, and notes that for squares, 50 is 1 squared plus 7 squared and also 5 squared plus 5 squared. None of that is searched here.

The search stops at 10^11, and the list stops at 20,000 numbers. That cap matters in cabtaxi mode. Up to 10^11 there are 145,081 numbers with two or more cabtaxi ways. The page counts all of them, lists the first 20,000, and says so.

Sources

Every source consulted for this guide. Links checked November 11, 2026.

  1. Taxicab number - Wikipedia Wikipedia (CC BY-SA 4.0)
  2. Cabtaxi number - Wikipedia Wikipedia (CC BY-SA 4.0)
  3. 1729 (number) - Wikipedia Wikipedia (CC BY-SA 4.0)
  4. Generalized taxicab number - Wikipedia Wikipedia (CC BY-SA 4.0)
  5. Fermat's Last Theorem - Wikipedia Wikipedia (CC BY-SA 4.0)
  6. A001235 - OEIS The On-Line Encyclopedia of Integer Sequences (CC BY-SA 4.0)
  7. A011541 - OEIS The On-Line Encyclopedia of Integer Sequences (CC BY-SA 4.0)
  8. A047696 - OEIS The On-Line Encyclopedia of Integer Sequences (CC BY-SA 4.0)
  9. BigInt - JavaScript | MDN MDN Web Docs (CC BY-SA 2.5 or later)
  10. Web Workers API - Web APIs | MDN MDN Web Docs (CC BY-SA 2.5 or later)
  11. TypedArray.prototype.sort() - JavaScript | MDN MDN Web Docs (CC BY-SA 2.5 or later)
  12. Math.cbrt() - JavaScript | MDN MDN Web Docs (CC BY-SA 2.5 or later)