Maths & numbers

Neighbouring perfect squares and cubes calculator

Find the perfect squares and cubes on either side of an integer and test whether it is already one.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

When the input is itself a square, the two square bounds coincide. The same rule applies independently to cubes.

THE FORMULAUse floor and ceiling of √n and ∛n, then square or cube them

A worked example

30 lies between 25 and 36 for squares and between 27 and 64 for cubes.

Good to know

Use a nonnegative whole number.

Bracket the input using integer roots

For 30, the square root is approximately 5.477. Taking the floor and ceiling of that root gives 5 and 6. Squaring these integers gives 25 and 36, which bracket the original input. The cube root is approximately 3.107, so the corresponding cube bases are 3 and 4, producing 27 and 64.

The calculator returns the value on each side, including equality. It does not select just one closest candidate. From 30, the square below is 5 units away and the square above is 6 units away. The cube below is 3 units away and the cube above is 34 units away.

Thirty lies between the squares twenty-five and thirty-six, and between the cubes twenty-seven and sixty-four25362764Square boundsCube bounds30
Both number lines use the same range from 25 to 64. The shared marker at 30 highlights how the two bracketing intervals differ.

Recognize exact powers and changing gaps

An input that is already a perfect square has identical lower and upper square bounds. At 36 both square bounds are 36. Its cube bounds are still 27 and 64 because 36 is not a perfect cube. An input can satisfy both tests, as 64 = 8² = 4³ does.

The gaps between successive squares grow as (k + 1)² − k² = 2k + 1. Successive cube gaps grow as 3k² + 3k + 1. This explains why the cube interval containing 30 is substantially wider than its square interval. The Floor and ceiling of a number calculator shows the rounding step that converts a root into the two integer bases used here.

A few questions, answered

What are the bounds for zero?

Both lower and upper squares and cubes are zero because 0² = 0³ = 0.

Are the neighbouring powers necessarily equally far away?

No. They bound the input but usually have different distances from it. Subtract the lower value and upper value separately to compare the gaps.

Find your calculator

Start typing to explore the library.