# Get the weekly multiplier by taking the 52 root of anchor's 20% yearly returns
weekly_interest_rate = pow(1.2, 1/52)
# Set ticket_price, split_factor, and prize_distributions
prize_distributions = [0, 0.00, .059, .184, .229, .287, .241]
# Build matching_chances so that matching_chances[i] gives the chance of a ticket having exactly i consecutive matches
# The idea is you want to take (1 / 16) ** i to get the chance of i consecutive matches,
# and then multiply by (15 / 16) to account for the fact that the number at i + 1 must not be a match
# (or else you would be counting a ticket with i + 1 matches, but we only want to include tickets with exactly i matches)
matching_chances = [pow(1/16, i) * (15 / 16 if i != len(prize_distributions) - 1 else 1) for i in range(len(prize_distributions))]
# Get the size of the lottery pool after one week proportional to the number of tickets.
# We take the ticket_prize times the split factor to get the value for which interest is going towards the lottery.
# Then multiply by the weekly interest rate to get the value we can put towards the lottery pool.
lottery_pool_size = ticket_price * split_factor * (weekly_interest_rate - 1)
# Get the expected payout sizes.
# For each prize_fraction, calculate the corresponding value of the lottery by multiplying with lottery_pool_size.
# Then divide by the chance of a corresponding winning ticket to get the expected value of the payout
expected_payouts = [lottery_pool_size * prize_fraction / matching_chances[index] for index, prize_fraction in enumerate(prize_distributions)]
# Print the expected payout sizes