Perfect cube checker
Find out whether a whole number is a perfect cube and get its integer root: 27 is 3 cubed, and −8 is −2 cubed, since cubes also exist below zero. A non-cube returns no, with the nearest lower root. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 27
- Root
- 3
- Root cubed
- 27
The perfect cube checker answers a classic number-theory question with a single deterministic contract: given an integer n, is n a perfect cube, and if so what integer root cubes to it? A perfect cube is any integer that can be written as k cubed for some integer k — zero is zero cubed, one is one cubed, eight is two cubed, twenty-seven is three cubed, sixty-four is four cubed, and one hundred twenty-five is five cubed. Unlike perfect squares, perfect cubes also exist on the negative side of the number line: negative eight is negative two cubed, negative twenty-seven is negative three cubed, and so on. The engine never relies on a floating-point cube root with a tolerance band, never samples randomness, never reads the clock, and never calls the network.
Where perfect-cube checks fit in study, coding practice, and automation
Students meet perfect cubes when learning volume of cubes, cubic growth, sum-of-cubes identities, and later when sieving for cube-free integers or testing cubic residues in modular arithmetic. Teachers can generate answer keys for worksheets without trusting opaque calculator apps that hide floating-point roots and disagree near large integers. Developers use the same contract to validate sample data for number-theory libraries, to gate property tests on random integer generators, or to pre-check that a seed is a perfect cube before a demonstration step that assumes an integer root.
Contest practice often needs a fast offline source of cube membership so solutions can be checked without downloading OEIS tables or hard-coding lists of cubes. Data pipelines that normalize catalog codes, puzzle IDs, or voxel dimensions sometimes need to reject non-cubes before a downstream step that takes a cube root as an integer edge length.
Pair it with a perfect-square checker when you need square membership, with sum-of-cubes tools when you need the closed formula for the first n cubes, and with prime factorization when you need the prime signature of n rather than whether n is a cube.
What you can do with it
Homework and contest classification
Decide whether integers are perfect cubes and recover the integer root for worksheets and contest checks without floating-point cube roots.
Teaching volume and cubic growth
Show students how k maps to k³ and how the floor cube root recovers the edge length while they change inputs live in the browser at no cost.
FAQ
What does the perfect cube checker cost?
It is free in your browser on this page.
Can n be negative?
Yes. Perfect cubes exist for negative integers: −8 is (−2)³, −27 is (−3)³, and so on. Zero is also a perfect cube with root zero.
What happens if n is not an integer?
Perfect cubes are defined for whole integers only; fractions, decimals, and scientific notation are rejected.
How is the perfect-cube test computed?
The engine computes the floor integer cube root of n with a binary search that multiplies candidates using exact BigInt arithmetic, then checks whether root cubed equals n. No floating-point Math.cbrt is used for the decision.
Is the algorithm randomized?
No. It uses deterministic integer multiplication and binary-search floor cube root.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/numth/perfect-cube-check \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":27}'const res = await fetch("https://api.kit.forhosting.com/numth/perfect-cube-check", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 27
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/perfect-cube-check",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 27
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/perfect-cube-check", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":27}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":27}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/perfect-cube-check", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"n": 27
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.perfect_cube_check",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
This tool rejects non-integers with invalid_input because the perfect-cube predicate is defined for whole integers only; fractions, decimals, and scientific notation never pass as cubes here. Explore free in the browser for homework, contest prep, and teaching demos, or call the API at $0.002 per successful request when grading scripts and pipelines need reproducible perfect-cube answers.
What a perfect cube is and how membership is decided
A perfect cube is an integer n for which there exists an integer k satisfying k cubed equals n. Ordering those cubes by the root gives the familiar sequence …, −125, −64, −27, −8, −1, 0, 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000, and so on in both directions. Membership is decided without guessing. Classic true cases include zero with root zero, one with root one, eight with root two, twenty-seven with root three, sixty-four with root four, and negative eight with root negative two. Non-cubes such as two, nine, ten, twenty-six, and negative nine return false with the corresponding floor root and its cube for context. This capability takes a single integer field n and returns four related values: the normalized n, a boolean is_perfect_cube, the integer cube root root, and root_cubed equal to root cubed. The engine computes the mathematical floor of the real cube root — the greatest integer root such that root cubed is less than or equal to n — then sets is_perfect_cube to true only when root cubed recovers n exactly. When n is not a cube, is_perfect_cube is false and root still reports that floor root so callers can see the nearest lower cube without a second request. Missing n, non-integers, fractions, scientific notation, and values outside the safe integer range all fail with invalid_input and a clear message. Non-cube integers are successful responses with is_perfect_cube false; they are not errors.
How inputs are read and how the integer cube root stays exact
For negative n the same non-negative search runs on the absolute value and the sign is applied with the mathematical floor convention: when the absolute value is not itself a cube, the floor root steps one unit further negative so that root cubed is still less than or equal to n. The only required field is n as a JSON integer, with aliases value, number, and x so forms, query strings, and SDK clients can reuse one contract without renaming every payload. Optional leading plus or minus signs are allowed; embedded spaces, hex prefixes, trailing decimals, and exponential notation are rejected so a bad spreadsheet cell does not become a wrong boolean. The parser insists on a whole safe integer: if you pass two point five, three halves, or one times ten to the six in scientific form, the request fails with invalid_input because perfect cubes are not defined for non-integers in this checker. Internally the floor cube root uses binary search over BigInt candidates, comparing mid times mid times mid against the target value, so there is no IEEE double step that could round a near-miss into a false perfect cube near the edges of the safe range.
Where perfect-cube checks fit in study, coding practice, and automation
On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result.
Integration use cases
Deterministic test fixtures
Generate reproducible cube and non-cube cases for unit tests, property checks, and CI assertions without embedding static tables.