Quote:
Originally Posted by zemlik
how do you work out the probability of 3 consecutive numbers occurring in 6/49 lottery ?
It's trickier than it looks.
[C(46,3) + 46*C(45,3) - C(44,2)] / C(49,6)
= 666974/13983816 =~ 4.769614%
If you're not careful, you will double count the cases where there are 2 sets of 3 consecutive numbers, or count multiple times the cases where there are 4,5, or 6 consecutive numbers. The trick is to count the number of ways to choose the FIRST 3 consecutive numbers, and then count the ways to choose the remaining numbers.
Say the numbers go from 1-49. There are 47 numbers on which the 3 consecutive can start since they can't start on 48 or 49. If the first 3 consecutive start at 1, then there are C(46,3) ways to choose the other 3. If the first 3 consecutive start on one of the other 46 numbers, the remaining numbers can't contain the number immediately prior to these 3 to make 4 consecutive because then there would be 3 consecutive that occur first. So the other numbers must be chosen from 45 possible numbers. There are C(45,3) ways to choose 3 numbers; however, some of these will still contain a separate group of 3 consecutive numbers that occur first. So we have to subtract these cases. But the number of such cases will depend on what number the 3 consecutive that we want to be first will start.
If they start at 1,2, 3, or 4, then there are no ways that 3 consecutive can occur first. Remember, when the first 3 consecutive start at 4, we have already excluded 123 which is the first part of the trick. If they start at 5, there is 1 way (123). If they start at 6, there are 2 ways (123, 234), and in general, if they start at n up to n=47, there are n-4 ways that 3 consecutive can occur first. So the number of cases that we need to subtract is
1 + 2 + 3 + ... + 43 = 43*44/2 = C(44,2).
So we subtract this term, and divide everything by C(49,6) total ways to choose the numbers to get the probability.
I hadn't considered this problem before. It is trickier than counting the number of ways to make a straight with 7 cards because of the possibility of making 2 separate "straights". I wrote a quick R program to verify the above calculation by enumerating every possible set of 6 numbers and counting the ones that contain 3 consecutive. It counted exactly 666974 just as we computed above.
Code:
count = 0
for (i in 1:44) {
for (j in (i+1):45) {
for (k in (j+1):46) {
for (m in (k+1):47) {
for (n in (m+1):48) {
for (o in (n+1):49) {
if ((k-i == 2) | (m-j == 2) | (n-k == 2) |(o-m ==2)) {
count = count + 1
}
}
}
}
}
}
}
count
count/choose(49,6)
Output:
> count
[1] 666974
> count/choose(49,6)
[1] 0.04769614
Last edited by BruceZ; 04-23-2012 at 04:01 PM.
Reason: 666974, not 999674