Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 77

Can You Find An Extra Perfect Square?

Riddler Express

Two congruent larger squares each touch a circle at one corner, and a smaller square, tilted 4545^\circ, touches the circle at two of its corners. How many times larger is a big square’s area than the small one’s?

Solution

Let the circle have centre OO, the big squares side xx and the tilted square side yy. The tilt makes the small square’s diagonal horizontal of length y2y\sqrt2, so its corners stick out y2\tfrac{y}{\sqrt2} to each side. Reading off the figure, a corner BB of a big square sits at horizontal distance OE=12(x+y2)OE = \tfrac12\big(x + \tfrac{y}{\sqrt2}\big) from the axis and height BE=xBE = x, while a corner AA of the small square sits at OF=OE+y2OF = OE + \tfrac{y}{\sqrt2} and AF=xy2AF = x - \tfrac{y}{\sqrt2}. Both corners lie on the circle, so they are equidistant from OO: OF2+AF2=OE2+BE2.OF^2 + AF^2 = OE^2 + BE^2. Expanding and cancelling collapses neatly to x2+3y2=0-\tfrac{x}{\sqrt2} + \tfrac{3y}{2} = 0, that is xy=32\tfrac{x}{y} = \tfrac{3}{\sqrt2}, and squaring, x2y2=92.\frac{x^2}{y^2} = \boxed{\tfrac92}.

The computation

Set y=1y = 1 and solve the equidistance condition (both corners on one circle) for xx, then report x2/y2x^2/y^2.

from scipy.optimize import fsolve
from math import sqrt
def equal_radii(x):
    x = x[0]
    OE = 0.5 * (x + 1 / sqrt(2)); BE = x
    AF = x - 1 / sqrt(2); OF = OE + 1 / sqrt(2)
    return [OF**2 + AF**2 - (OE**2 + BE**2)]
x = fsolve(equal_radii, [2.0])[0]
print(x**2)                                    # 4.5 = 9/2

Riddler Classic

For some perfect squares, deleting the last digit leaves a different perfect square (for instance 25625256 \to 25). After 16,49,169,256,36116, 49, 169, 256, 361, what are the next three? How many are there? Extra credit: 169161169 \to 16 \to 1 stays square even after deleting two digits; is there another square like that?

Solution

Square each whole number, chop off its last digit, and keep the cases where what remains is itself a perfect square. After the five given, the next three are 1444, 3249, 18496\boxed{1444,\ 3249,\ 18496} (382144=12238^2 \to 144 = 12^2, 572324=18257^2 \to 324 = 18^2, 13621849=432136^2 \to 1849 = 43^2), and the sequence never stops: 64009,237169,364816,64009, 237169, 364816, \dots keep coming, so there are infinitely many.

The double property of 169169 is far rarer. Searching every square up to 101610^{16} for one whose last two digits can both be peeled off to leave squares each time turns up nothing else: 169 stands alone.\boxed{169 \text{ stands alone.}}

The computation

Test each square by deleting its last digit and checking whether the result is a perfect square; for the extra credit, require the twice-shortened number to be square as well.

from math import isqrt
def is_sq(m): return m >= 0 and isqrt(m)**2 == m
singles = [n*n for n in range(4, 200) if is_sq((n*n) // 10)]
print(singles[:8])                             # ...1444, 3249, 18496
doubles = [n*n for n in range(4, 2_000_000)
           if is_sq((n*n) // 10) and (n*n) // 100 >= 1 and is_sq((n*n) // 100)]
print(doubles)                                  # [169]