ForHosting KIT · Math

Taxicab number representations as sums of two positive cubes

1729 can be written as 1³ + 12³ and as 9³ + 10³, so it has two representations. Enter a whole number to see every pair of positive cubes that adds up to it, or an empty result if none does. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
N
1,729
You get
Quantity
2

A taxicab representation writes an integer as the sum of two positive integer cubes. This calculator checks a supplied integer and returns every distinct pair that works, placing the smaller base first so reversed duplicates never clutter the result. It is useful for exploring famous taxicab numbers, checking number-theory exercises, and testing conjectures with an exact deterministic calculation. Numbers without a matching pair are valid inputs too: they return an empty list and a count of zero rather than an error.

What the result means

Each returned record contains two positive integers, a and b, whose cubes add exactly to the requested number. The calculator always enforces a less than or equal to b, so 1 cubed plus 12 cubed and 12 cubed plus 1 cubed are treated as the same representation. The expression field presents the same equality in a compact readable form, while count tells you how many genuinely different unordered pairs were found.

A count of zero is not a failure. It means the integer has no representation as a sum of two positive cubes within the stated definition. Positive matters here: zero and negative bases are deliberately excluded, so this tool answers the classical taxicab-style question rather than the broader signed sum-of-cubes problem.

For example, a number may have a signed representation but still produce an empty list here. This precise convention makes results comparable across classroom work, recreational mathematics, and programmatic searches without requiring users to remove mirrored pairs themselves.

How every pair is found

The algorithm begins with the smallest allowed first base and the largest possible second base. It compares their cube sum with n. When the sum is too small, increasing the first base is the only move that can reach the target; when it is too large, decreasing the second base is the only useful move.

On an exact match, the pair is recorded and both pointers move inward. Because cube values increase strictly for positive integers, this two-pointer walk cannot skip a valid pair and cannot report the same pair twice. It also avoids testing every possible combination.

Instead of a square number of comparisons, it performs work proportional to the cube root of the input. All arithmetic stays inside JavaScript's safe integer range under the declared maximum input, so equality checks remain exact rather than approximate. There is no random sampling, external lookup table, or network request.

Choosing inputs and using the output

Supply n as an integer from 2 through 1,000,000,000,000. Fractions, numeric strings, non-finite values, unsafe integers, and values below two are rejected because they do not satisfy the published input contract. If you are studying a known taxicab number, inspect count first and then use the representations array for the actual bases.

If you are scanning many candidates, an empty array can be handled as an ordinary result, while a validation error should prompt correction of the input.

Check a famous taxicab number

Confirm the distinct positive-cube pairs behind a known example such as 1729.

Verify a number-theory exercise

Compare a hand-derived list of cube pairs with a complete deterministic result.

Build a mathematical dataset

Request individual integers and store their normalized representation counts and base pairs.

What counts as a distinct representation?

A pair of positive integers with the smaller base first. Reversing the two bases does not create another representation.

Are zero or negative cubes included?

No. Both cube bases must be positive integers.

Why must n be at least two?

The smallest sum of two positive cubes is 1 cubed plus 1 cubed, which equals two.

How many ways can 1729 be written as a sum of two cubes?

Two: 1³ + 12³ and 9³ + 10³. Each pair is listed with the smaller number first, so 12³ + 1³ is not counted again as a separate way.

What is the largest number I can check?

You can check any whole number from 2 up to 1,000,000,000,000. Within that range every sum of cubes is compared exactly, so a match is never the product of rounding.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/numth/taxicab-representations

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/numth/taxicab-representations \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":1729}'
{
  "n": 1729
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "numth.taxicab_representations",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

How every pair is found

The same pure function supports the API and browser execution, giving both channels identical ordering, fields, validation, and results.

Choosing inputs and using the output

Remember that this capability tests one integer per request; it does not search an interval for the next taxicab number or prove that a number is minimal among those having a given number of representations. Those are different computational questions. API use costs $0.002 per request, while the deterministic result format makes it straightforward to store or compare answers downstream.

What happens when there are no representations?

The request succeeds with count set to zero and an empty representations array.

How much does an API request cost?

Each API request costs $0.002.

Read the full KIT documentation →