## 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
= 100000
runs = 0.8
frac_day = 1 - frac_day
frac_mail = 1000000
num_total = trunc(Int32, frac_day*num_total), trunc(Int32, frac_mail*num_total)
num_day, num_mail = 0
succ for i in 1:runs
= rand(Bernoulli(0.5), num_total)
votes if sum(votes[1:num_day]) < 0.5*num_day && sum(votes) > 0.5*num_total
+= 1
succ end
end
print(2*succ/runs)
```