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 , 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 , the big squares side and the tilted square side . The tilt makes the small square’s diagonal horizontal of length , so its corners stick out to each side. Reading off the figure, a corner of a big square sits at horizontal distance from the axis and height , while a corner of the small square sits at and . Both corners lie on the circle, so they are equidistant from : Expanding and cancelling collapses neatly to , that is , and squaring,
The computation
Set and solve the equidistance condition (both corners on one circle) for , then report .
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 ). After , what are the next three? How many are there? Extra credit: 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 (, , ), and the sequence never stops: keep coming, so there are infinitely many.
The double property of is far rarer. Searching every square up to for one whose last two digits can both be peeled off to leave squares each time turns up nothing else:
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]