Can You Cut The Perfect Pancake?

A FiveThirtyEight Riddler puzzle.
mathematics
Riddler
Published

April 23, 2021

Riddler Classic

Riddler Nation’s neighbor to the west, Enigmerica, is holding an election between two candidates, \(A\) and \(B\). Assume every person in Enigmerica votes randomly and independently, and that the number of voters is very, very large. Moreover, due to health precautions, \(20\) percent of the population decides to vote early by mail.

On election night, the results of the \(80\) percent who voted on Election Day are reported out. Over the next several days, the remaining \(20\) percent of the votes are then tallied.

What is the probability that the candidate who had fewer votes tallied on election night ultimately wins the race?

Computational Solution

The probability that the candidate who had fewer votes tallied on election night ultimately wins the race is approximately \(\bf{14.82}\).

using Distributions
runs = 100000
frac_day = 0.8
frac_mail = 1 - frac_day
num_total = 1000000
num_day, num_mail = trunc(Int32, frac_day*num_total), trunc(Int32, frac_mail*num_total) 
succ = 0
for i in 1:runs
        votes = rand(Bernoulli(0.5), num_total)
        if sum(votes[1:num_day]) < 0.5*num_day && sum(votes) > 0.5*num_total
                succ += 1
        end
end
print(2*succ/runs)
Back to top