#math trivia for #February23: #54 is halfway between a #cube and a #square, two different ways. What are they? (Positive numbers only.)

— Burt Kaliski Jr. (@modulomathy) February 23, 2012

One solution is 27 (= 3^{3}) and 81 (= 9^{2}).

The other is 8 (=2^{3}) and 100 (=10^{2}).

The problem can be solved by trial and error. Here’s one approach.

Because both the cube and the square must be positive, the smallest value either can have is 1, and the largest is 107. There are fewer cubes than squares, so just try the cubes in this range and see if there’s a matching square.

The possibilities are:

- 1 and 107 — not a square
- 8 and 100 — correct
- 27 and 81 — correct
- 64 and 44 — not a square

At most, this takes on the order of the cube root of 2*n* operations to solve in general, where *n* is the midpoint value.