Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 61

Can You Bake The Radish Pie?

Riddler Express

Start with any positive amount of flour. Replace it by the average of itself and 33 divided by itself, and repeat forever. How many cups does the recipe converge to?

Solution

Call the running amount ff. Each step sends ff to 12 ⁣(f+3f)\tfrac12\!\left(f + \tfrac3f\right). If this settles to a limit, the limit is a fixed point, unchanged by the step: f=12(f+3f)    2f=f+3f    f2=3    f=3.f = \frac12\left(f + \frac3f\right) \;\Longrightarrow\; 2f = f + \frac3f \;\Longrightarrow\; f^2 = 3 \;\Longrightarrow\; f = \boxed{\sqrt3}. The recipe is Newton’s method for a\sqrt a in disguise: the iteration x12(x+a/x)x \mapsto \tfrac12(x + a/x) converges to a\sqrt a from any positive start, here with a=3a = 3. So whatever amount of flour you begin with, you end at 31.732\sqrt3 \approx 1.732 cups.

The computation

Iterate the recipe from an arbitrary start and watch it converge.

def num_cups(start=2.0):
    s = start
    while True:
        c = 0.5 * (s + 3 / s)
        if abs(s - c) < 1e-12: return c
        s = c
print(num_cups())                              # 1.7320508... = sqrt(3)

Riddler Classic

In a regular 10001000-gon with side length 22, take a longest diagonal (joining opposite vertices). The diagonals perpendicular to it slice it into 500500 pieces. What is the product of the piece lengths? Extra credit: in a regular 10011001-gon with side 22, slice the altitude from a vertex the same way into 500500 pieces, and find that product.

Solution

Put the long diagonal on the xx-axis. Going up the right half of the polygon, each successive side turns by 2πn\tfrac{2\pi}{n}, and the perpendicular diagonals meet the axis at the vertices’ xx-coordinates. The piece between two consecutive cuts is the projection of one side onto the axis, which for the kk-th side works out to Vk=2sin ⁣((2k1)πn),k=1,,n2,V_k = 2\sin\!\Big((2k-1)\frac{\pi}{n}\Big), \qquad k = 1, \dots, \tfrac n2, so the product is P=k=1n/22sin ⁣((2k1)πn)P = \prod_{k=1}^{n/2} 2\sin\!\big((2k-1)\tfrac{\pi}{n}\big). To evaluate it, recall that the non-trivial nn-th roots of unity give k=1n1(1e2πik/n)=n\prod_{k=1}^{n-1}\big(1 - e^{-2\pi i k/n}\big) = n. Writing each sine through complex exponentials and separating the odd-indexed factors from the even-indexed ones turns the product into nn divided by n2\tfrac n2: P=k=1n1(1e2πik/n)k=1n/21(1e2πik/(n/2))=nn/2=2.P = \frac{\prod_{k=1}^{n-1}\big(1 - e^{-2\pi i k/n}\big)}{\prod_{k=1}^{n/2-1}\big(1 - e^{-2\pi i k/(n/2)}\big)} = \frac{n}{\,n/2\,} = \boxed{2}. Remarkably the side length and the value n=1000n = 1000 drop out entirely. For the odd case the same sine-product identity k=1n12sinkπn=n\prod_{k=1}^{n-1}2\sin\tfrac{k\pi}{n} = n splits into odd and even terms, each equal to PP, giving P2=nP^2 = n: P=n=100131.64.P = \sqrt{n} = \sqrt{1001} \approx \boxed{31.64}.

The computation

For n=1000n = 1000, build the polygon from coordinates, find where the perpendicular (vertical) diagonals cut the horizontal long diagonal, and multiply the gaps. For the odd case multiply the piece lengths VkV_k directly.

import numpy as np
def diagonal_product(n):                       # even n: direct construction
    R = 1 / np.sin(np.pi / n)                   # circumradius, side length 2
    cuts = sorted({R * np.cos(2 * np.pi * j / n) for j in range(n // 2 + 1)})
    return np.prod(np.diff(cuts))
print(diagonal_product(1000))                  # 2.0
k = np.arange(1, 501)
print(np.prod(2 * np.sin((2 * k - 1) * np.pi / 1001)))  # 31.638... = sqrt(1001)