3 min read

Centered Pentagonal Number

Table of Contents

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 5050 stars on the American flag are arranged in such a way that they form two rectangles. The larger rectangle is 55 stars wide, 66 stars long; the smaller rectangle is embedded inside the larger and is 44 stars wide, 55 stars long. This square-like pattern of stars is possible because the number of states (50)(50) is twice a square number (25)(25).

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 5151 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 NN equals 5050, NN is twice a square and N+1N+1 is a centered pentagonal number. After 5050, what is the next integer NN with these properties?

Solution

We are looking for an NN that satisifies the following:

N+1=5p2+5p+22N=2q2\begin{align*} N + 1 &= \frac{5p^2+5p+2}{2} \\ N &= 2q^2 \end{align*}

for some integers pp and qq.

From the above we have 5(2p+1)2βˆ’5=16q25(2p+1)^2 - 5 = 16q^2 or x2βˆ’80q2=1x^2 - 80q^2 = 1 where x=2p+1x=2p+1 and q=5yq=5y.

The equation x2βˆ’80y2=1x^2 - 80y^2 = 1 is a Pell’s equation.

If (x,y)=(u,v)(x,y)=(u,v) is a solution of the above equation, a whole family of solutions can be found by taking each side to the nthn^{th} power ,

x2βˆ’80y2=(u2βˆ’80v2)n=1.x^2 - 80y^2 = (u^2 - 80v^2)^n = 1.

Factoring gives,

x+80y=(u+80v)nxβˆ’80y=(uβˆ’80v)nx + \sqrt{80}y = (u + \sqrt{80}v)^n \\ x - \sqrt{80}y = (u - \sqrt{80}v)^n

which gives the whole family of solutions

x=(u+v80)n+(uβˆ’v80)n2y=(u+v80)nβˆ’(uβˆ’v80)n280x = \frac{(u + v\sqrt{80})^n + (u - v\sqrt{80})^n}{2}\\ y = \frac{(u + v\sqrt{80})^n - (u - v\sqrt{80})^n}{2\sqrt{80}}

It is easy to see that (u,v)=(9,1)(u,v)=(9,1) is a solution to x2βˆ’80y2=1x^2 - 80y^2=1.

For n=1n=1, we have x=9x=9, therefore p=4p=4 and N=50N=50. For n=2n=2, we have x=161x=161, therefore p=80p=80 and N=16200N=16200.

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))