How to count the number of elements needed to get a certain sum?

39 Views Asked by At

I want to find $x$ in this equation: $$ \sum_{n=1}^x\left[\left(1- {49\choose6}^{-1}\right)^{n-1} \times {49 \choose 6}^{-1}\right] \geqslant 0.5 $$ If I'm thinking correctly, that's the question of how many coupons should I buy, so my chance of winning would be at least $50\%$, providing I win by correctly choosing $6$ numbers out of $49$. The order of the numbers doesn't matter, no returns. My intention was to use the geometric distribution cumulative probability formula: $$\sum_{n=1}^k \left[(1-p)^{n-1} \times p\right] $$ where $ p = {49 \choose 6}^{-1} $. So what is the minimum $x$ with which my overall probability would be something close to $50\%$?

I don't want to calculate it by hand, Wolfram Alpha formula is enough for me. I just can't get it right, it always spits out something that is not my $x$. I also have a CASIO calculator but I doubt it can calculate that.

1

There are 1 best solutions below

2
On BEST ANSWER

If you have a sum $$S(n)=p\sum_{k=1}^n(1-p)^{k-1}$$ You can work out explicitly that $$S(n)=1-(1-p)^n$$ See geometric series. So $$1-(1-p)^n>0.5$$ $$(1-p)^n<0.5$$ $$\log((1-p)^n)<\log(0.5)$$ $$n>\frac{\log(0.5)}{\log(1-p)}$$ $$n\geq \left\lceil\frac{\log(0.5)}{\log(1-p)}\right\rceil$$ If you can't be bothered with any of that, Python works too.

import math
def Binom(n,k):
    return math.factorial(n)/(math.factorial(n-k)*math.factorial(k))
p=1/Binom(49,6)
n=1
S=0
while (S<0.5):
    S+= p*(1-p)**(n-1)
    n+=1
print(n-1)

Either way, the number you're looking for is

$$n=9~692~843$$