Can You Reach The Summit First?

A FiveThirtyEight Riddler puzzle.

By Vamshi Jandhyala in mathematics Riddler

September 16, 2020

Riddler Express

Once a week, folks from Blacksburg, Greensboro, and Silver Spring get together for a game of pickup basketball. Every week, anywhere from one to five individuals will show up from each town, with each outcome equally likely.

Using all the players that show up, they want to create exactly two teams of equal size. Being a prideful bunch, everyone wears a jersey that matches the color mentioned in the name of their city. However, since it might create confusion to have one jersey playing for both sides, they agree that the residents of two towns will combine forces to play against the third town’s residents.

What is the probability that, on any given week, it’s possible to form two equal teams with everyone playing, where two towns are pitted against the third?

Extra credit: Suppose that, instead of anywhere from one to five individuals per town, anywhere from one to $N$ individuals show up per town. Now what’s the probability that there will be two equal teams?

Solution

Let $b,g$ and $s$ be the number of people from Blacksburg, Greensboro and Silver spring on a given week.

The total number of $3-tuples$ of the form $(b,g,s)$ where $1 \leq b \leq N$,$1 \leq g \leq N$ and $1 \leq s \leq N$ is $N^3$.

When equal teams can be formed from $b,g$ and $s$, we have $b + g = s$ or $b + s = g$ or $s + g = b$.

The equation $b + g = n$ has the following solutions:

$$ 1 + (n-1) \
2 + (n-2) \
. \
. \
. \
(n-1) + 1 $$

Therefore, the number of solutions of the equation is $n-1$.

The total number of solutions to the set of equations $b + g = s$ or $b + s = g$ or $s + g = b$ where $1 \leq b \leq N$,$1 \leq g \leq N$ and $1 \leq s \leq N$ is given by $ 3(1 + 2 + \dots + N-1) = 3N(N-1)/2$.

The probability of forming two equal teams satisfying the given criteria is $\frac{3N(N-1)/2}{N^3}$.

Computational solution in Python

from itertools import product
n = 5

m = 0
for b,g,s in product(*[range(1, n+1)]*3):
    if b+g==s or b+s==g or s+g==b:
        m += 1
print(m, m/n**3)

Riddler Classic

For every mountain in the Tour de FiveThirtyEight, the first few riders to reach the summit are awarded points. The rider with the most such points at the end of the Tour is named “King of the Mountains” and gets to wear a special polka dot jersey.

At the moment, you are racing against three other riders up one of the mountains. The first rider over the top gets $5$ points, the second rider gets $3$, the third rider gets $2$, and the fourth rider gets $1$.

All four of you are of equal ability — that is, under normal circumstances, you all have an equal chance of reaching the summit first. But there’s a catch — two of your competitors are on the same team. Teammates are able to work together, drafting and setting a tempo up the mountain. Whichever teammate happens to be slower on the climb will get a boost from their faster teammate, and the two of them will both reach the summit at the faster teammate’s time.

As a lone rider, the odds may be stacked against you. In your quest for the polka dot jersey, how many points can you expect to win on this mountain, on average?

Computational solution in Python

from more_itertools import locate

cnt,tp = 0, 0
for p in distinct_permutations('ABCC'):
    cnt += 1
    pos_A = list(locate(p, lambda x: x == 'A'))[0]
    pos1_C, pos2_C = list(locate(p, lambda x: x == 'C'))
    if pos_A == 0:
        tp += 5
    if pos_A == 3:
        tp += 1
    if pos1_C < pos_A < pos2_C:
        if pos_A == 1:
            tp += 2
        if pos_A == 2:
            tp += 1
    else:
        if pos_A == 1:
            tp += 3
        if pos_A == 2:
            tp += 2

print(tp/cnt)