Edit: Python code added. Question corrected
Right, i am trying to figure out my chances of drawing certain cards in MTG, so that is my frame. I have 4 of the same card and 56 fillers (60 in total)
I can figure out how to calc the chances of having at least 1 of the 4 cards drawn after 1.,2.,3.,4....60. draws.
I can figure out how to cal the chances of drawing 1 of the 4 in 1. draw and then 2 of the 4 in 2. draw.
WHAT i would like to figure out is how to calc the chances of having drawn 2 of the 4 cards after 2.,3.,4.,5.,6.....60. draw, with no cards going back in the deck. (first draw 0%, draw 58, 59, 60 100%)
I made a card drawing script in python and ran i 1.000.000 times, and it gave me the following numbers. Chance of drawing x amount i n draws:
x n 1/4 1: 6.67390% 2: 12.99830% 3: 18.98930% 4: 24.65400% ... 57: 100% ... 2/4 1: 0.00000% 2: 0.33760% 3: 0.98370% 4: 1.92270% ... 58: 100% ...
I've done some "research" and found a lot of math that i didnt really understand (i have no training what so ever in math) but i found some that i made into the following code:
print(1-(factorial(N-n) * factorial(n) * factorial(N-n)) / (factorial(n) * factorial(N-n-n) * factorial(N)))
So what i need, if someone wouldn't mind taking the time to write down the propper math needed. With explanations would be great, but if i can just get the math i at least know where i am going towards.
Edit: This is the python script i came up with after i got the answer below:
from math import * #N is the total population (of cards) #n is the total desired population (of cards) #r is the total expected draws of the desired population result, N, n, r = 0, 60, 4, 2 for k in range(r, N-(n-r-1)): a = factorial(k - 1) / (factorial(r - 1) * factorial(k - r)) b = factorial(N - k) / (factorial(n - r) * factorial(N - k - n + r)) c = factorial(N) / (factorial(N - n) * factorial(n)) result +=(a * b)/c print(result*100)
for ease of reading/understanding, i have kept the 3 parts to the problem separated as a, b and c.
Python code for my draw script: https://www.pastiebin.com/5bd96e1930d39 (I am nearly as bad at programming as i am at math)