Day 6
Part 1
races =
[62, 64, 91, 90]
|> Enum.zip([553, 1010, 1473, 1074])
example = [{7, 9}, {15, 40}, {30, 200}]
races
|> Enum.map(fn {time, distance} ->
Enum.count(0..time, &(&1 * (time - &1) > distance))
end)
|> Enum.product()
840336
Part 2
time = 62_649_190
dist = 553_101_014_731_074
# how many n such that n * (62649190 - n) > 553101014731074
# we could do some algebra and find zeroes but...
minTime = 0..time |> Enum.find(&(&1 * (time - &1) > dist))
10633311
maxTime = time - minTime
minTime..maxTime |> Enum.count()
41382569