Problem
Here is this weekβs Riddlerβs Classic
Just in time for the Fourth of July, this weekβs Classic is about stars on the American flag:
The stars on the American flag are arranged in such a way that they form two rectangles. The larger rectangle is stars wide, stars long; the smaller rectangle is embedded inside the larger and is stars wide, stars long. This square-like pattern of stars is possible because the number of states is twice a square number .
Now that the House of Representatives has passed legislation that would make the District of Columbia the fifty-first US state β and renamed Washington, Douglass Commonwealth, in honor of Frederick Douglass β a natural question is how to aesthetically arrange stars on the flag.
One pleasing design has a star in the middle, surrounded by concentric pentagons of increasing side length, as shown below. The innermost pentagon has five stars, and subsequent pentagons are made up of 10, 15 and 20 stars. All told, thatβs 51 stars.
It just so happens that when equals , is twice a square and is a centered pentagonal number. After , what is the next integer with these properties?
Solution
We are looking for an that satisifies the following:
for some integers and .
From the above we have or where and .
The equation is a Pellβs equation.
If is a solution of the above equation, a whole family of solutions can be found by taking each side to the power ,
Factoring gives,
which gives the whole family of solutions
It is easy to see that is a solution to .
For , we have , therefore and . For , we have , therefore and .
Brute force computational solution
from math import sqrt
for p in range(1, 1000):
t = (5*p**2 + 5*p)/4
if sqrt(t).is_integer():
print("N = ", int(2*t))