How this instrument works
A perfect cube is an integer that equals some whole number multiplied by itself twice more — k × k × k, written k³. The first positive examples are 1, 8, 27, 64, and 125, and the pattern runs negative too, since (−3)³ = −27 qualifies just as much as 27 does. The Test value field checks that membership directly: round the cube root of n back to the nearest whole number, cube that rounded value, and subtract n. A genuine perfect cube survives the round trip with nothing left over, so the result lands on exactly 0.
The engine takes a deliberate detour around a specific trap. Raising a negative number to the power one-third by the usual x^(1/3) route relies on logarithms, and the logarithm of a negative number has no real value, so a naive formula would fail on every negative input. Cubing is an odd-degree operation, though, so it never loses the sign the way squaring does — every real number, negative ones included, owns exactly one real cube root. The formula sidesteps the logarithm problem by pulling the sign out first, cube-rooting the absolute value, then reapplying the sign before rounding and cubing back.
Cubes thin out fast compared with squares. Below 1,000,000 there are 1,000 perfect squares but only 100 perfect cubes — the count of squares up to any ceiling N grows like √N, while the count of cubes grows like the far smaller ∛N, so cubes get rarer the higher you count. Zero is a perfect cube in its own right, since 0³ = 0, an edge case worth remembering precisely because it is easy to overlook. Cubes also carry one of mathematics' best-known anecdotes: 1729, not itself a cube, is the smallest number that splits into two cubes in two separate ways — 1³+12³ and 9³+10³ — the story behind Hardy and Ramanujan's taxicab number.
- Type the whole number you want to check into the n field — positive, negative, or zero are all valid entries.
- Read the Test value (0 = perfect cube) field: an exact 0 confirms n is a perfect cube.
- A nonzero result is the gap between n and the nearest cube once its rounded cube root is cubed back — not a fuzzy 'almost'.
- Try n = 30 to see a near-miss (test = −3), then n = −8 to confirm negative perfect cubes are recognized too (test = 0).
Worked example — testing n = 27
Enter 27 into n. Its exact cube root is 3, since 3³ = 27, so rounding 3 to the nearest whole number leaves it unchanged; cubing that 3 back gives 27 again, and subtracting the original 27 leaves the Test value field reading exactly 0 — confirming 27 is a perfect cube, the textbook case of 3 cubed.
Change n to 30, one step further along, and the picture flips: ∛30 ≈ 3.1072, which rounds to 3, cubes back to 27, and 27 − 30 leaves a Test value of −3 — the exact gap to the nearest cube below. That contrast is why a reading of 0 is never a rounding coincidence: only an n sitting precisely on a cube produces it, and every other whole number reports its distance instead.
Questions
What exactly counts as a perfect cube?
An integer that equals some whole number cubed: 1, 8, 27, 64, 125, and so on, together with their negative counterparts −1, −8, −27, since (−k)³ = −k³. Zero counts too, because 0³ = 0. A number like 30, sitting between 27 (3³) and 64 (4³), does not qualify, even though every real number has a cube root.
How does the Test value field detect a perfect cube?
It rounds ∛n to the nearest whole number, cubes that whole number, and subtracts n. Enter 27 and the cube root rounds to 3, which cubes back to 27, leaving a Test value of 0. Enter 30 instead and the same rounding to 3 cubes back to only 27, leaving a Test value of −3 — the exact shortfall from the nearest cube.
Why does this calculator accept negative numbers, unlike a perfect-square checker?
Because cubing is an odd-degree power and keeps the sign, so every real number — negative ones included — has exactly one real cube root: ∛(−8) = −2 exactly, since (−2)³ = −8, giving a Test value of 0. Squaring erases sign instead, since both k and −k square to the same positive result, so perfect-square checks are restricted to n ≥ 0.
How is a perfect cube different from a perfect square?
A perfect square is k² for some integer k and is always zero or positive. A perfect cube is k³, and because negative numbers cube to negative results, perfect cubes run in both directions: −27, −8, −1, 0, 1, 8, 27. The two tests share a family resemblance but check a genuinely different property of n.
Are perfect cubes rarer than perfect squares?
Yes, and the gap widens quickly. Below 1,000,000 there are 1,000 perfect squares but only 100 perfect cubes, because the count of squares up to any ceiling grows like its square root while the count of cubes grows like its cube root — a far slower-climbing quantity, so cubes get sparser the higher you count.
What is the connection between 1729 and perfect cubes?
1729 is not itself a perfect cube, but it is the smallest number expressible as a sum of two cubes in two different ways: 1³ + 12³ and 9³ + 10³, both equal to 1729. It is known as the Hardy–Ramanujan number, after the story of Ramanujan recognizing the property in a taxicab's license plate.