This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from math import comb | |
| def tax_coefficient(r): | |
| if r <= 100: | |
| return 0 | |
| elif 100 < r <= 200: | |
| return 0.025 | |
| elif 200 < r <= 500: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use rand::{seq::SliceRandom, Rng}; | |
| use rayon::prelude::*; | |
| use rust_decimal::{prelude::FromPrimitive, Decimal}; | |
| use std::time::Instant; | |
| use std::{cmp::min, str::FromStr}; | |
| const EXPECTED_TOTAL_COUPONS_PLAYED: u32 = 7_000_000; | |
| const N_SIMULATIONS: u32 = 10_000; | |
| const JACKPOT: u32 = 22_000_000; | |
| const SECOND_CATEGORY_POT: u32 = 2_000_000; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Node: | |
| def __init__(self, val): | |
| self.value = val | |
| self.size = 1 | |
| '''size holds the number of a node's offsprings | |
| it is used when we apply union | |
| ''' | |
| self.parent = self | |
| def find(x): |