## Riddler Express

I have a spherical pumpkin. I carefully calculate its volume in cubic inches, as well as its surface area in square inches.

But when I came back to my calculations, I saw that my units — the square inches and the cubic inches — had mysteriously disappeared from my calculations. But it didn’t matter, because both numerical values were the same!

What is the radius of my spherical pumpkin?

Extra credit: Let’s dispense with 3D thinking. Instead, suppose I have an $n$-hyperspherical pumpkin. Once again, I calculate its volume (with units $in^n$) and surface area (with units $in^{n−1}$). Miraculously, the numerical values are once again the same! What is the radius of my $n$-hyperspherical pumpkin?

## Solution

Let $r$ be the radius of the spherical pumpkin. We have

$$\frac{4}{3}\pi r^3 = 4\pi r^2 \implies r = 3 in$$

The recurrence relation for the surface area of an $n$-ball $V_n(R)$ is given by

$$A_n(R) = \frac{d}{dR}V_{n}(R) = \frac{n}{R}V_{n}(R)$$

If $A_n(R) = V_n(R)$, we have $R = n$.

## Riddler Classic

Congratulations, you’ve made it to the fifth round of The Squiddler — a competition that takes place on a remote island. In this round, you are one of the $16$ remaining competitors who must cross a bridge made up of $18$ pairs of separated glass squares. Here is what the bridge looks like from above: To cross the bridge, you must jump from one pair of squares to the next. However, you must choose one of the two squares in a pair to land on. Within each pair, one square is made of tempered glass, while the other is made of normal glass. If you jump onto tempered glass, all is well, and you can continue on to the next pair of squares. But if you jump onto normal glass, it will break, and you will be eliminated from the competition.

You and your competitors have no knowledge of which square within each pair is made of tempered glass. The only way to figure it out is to take a leap of faith and jump onto a square. Once a pair is revealed — either when someone lands on a tempered square or a normal square — all remaining competitors take notice and will choose the tempered glass when they arrive at that pair.

On average, how many of the $16$ competitors will survive and make it to the next round of the competition?

## Computational Solution

Let $S(n, m)$ be the expected number of survivors when there are $n$ competitors and $m$ pairs of glasses. We have the recurrence relation

$$S(n, m) = \frac{1}{2}S(n, m-1) + \frac{1}{2}S(n-1, m-1) \\ S(n, 0) = n \\ S(0, m) = 0$$

The Python code to compute $S(n, m)$ is given below:

def S(n , m):
if n == 0:
return 0
if m == 0:
return n
return 0.5*S(n, m-1) + 0.5*S(n-1, m-1)


On average, if there are $16$ competitors and $18$ pairs of glasses, we will have $\textbf{7}$ survivors.