richacm
02-25-2009, 07:24 PM
Hi, I have been thinking about lotto formulas. Here is my one for getting the probablity:
lotto <- function(n,k) {
factorial(n) / (factorial(k)*factorial(n-k))
}
then I could do:
lotto(40,6)
My question is what would be the formula for:
1. Probability that all evens/odds were drawn
2. Probability that sequential numbers were drawn e.g. 23,24
3. Probability that 3 sequential numbers were drawn e.g. 12,13,14
4. Combination of these e.g. 2 & 3, or 1 & 2 (=0 I know).
Cheers,
Craig
lotto <- function(n,k) {
factorial(n) / (factorial(k)*factorial(n-k))
}
then I could do:
lotto(40,6)
My question is what would be the formula for:
1. Probability that all evens/odds were drawn
2. Probability that sequential numbers were drawn e.g. 23,24
3. Probability that 3 sequential numbers were drawn e.g. 12,13,14
4. Combination of these e.g. 2 & 3, or 1 & 2 (=0 I know).
Cheers,
Craig