For green = 0, C(7, 5) For green = 1, C(7, 4) * C(5, 1)
Total ways = C(7, 5) + (C(7, 4) * C(5, 1))
library(pracma)
## Warning: package 'pracma' was built under R version 4.3.2
nchoosek(7, 5) + (nchoosek(7, 4) * nchoosek(5, 1))
## [1] 196
For representatives = 4, C(13, 4), C(14, 1) For representatives = 5, C(13, 5)
Total ways = C(13, 4) * C(14, 1) + C(13, 5)
nchoosek(13, 4) * nchoosek(14, 1) + nchoosek(13, 5)
## [1] 11297
For the coin toss, \(2^5\) For the die, \(6^2\) For the cards, C(52, 3)
Total outcomes: multiply all outcomes together #### Answer: 25459200 outcomes . . . 2.546 x 10^7 outcomes
(2 ** 5) * (6 ** 2) * (nchoosek(52, 3))
## [1] 25459200
P(0 cards is a 3): C(48, 3)
Answer: 0.2174
1 - (nchoosek(48, 3) / nchoosek(52, 3))
## [1] 0.2173756
nchoosek(31, 5)
## [1] 169911
nchoosek(31, 5) - nchoosek(17, 5)
## [1] 163723
num_brahms <- 4
num_haydn <- 104
num_mendelssohn <- 17
x <- 3
perms_brahms <- factorial(num_brahms) / factorial(num_brahms - x)
perms_haydn <- factorial(num_haydn) / factorial(num_haydn - x)
perms_mendelssohn <- factorial(num_mendelssohn) / factorial(num_mendelssohn - x)
total_schedules <- as.numeric(perms_brahms * perms_haydn * perms_mendelssohn)
print(total_schedules)
## [1] 106989742080
total_books <- 13
max <- 4
total_schedules <- 0
for (a in 0:6) {
for (b in 0:6) {
for (c in 0:7) {
for (books in 0:max) {
if (a + b + c + books == total_books) {
# Calculate the contribution of this combination
newNumber <- (factorial(6) / factorial(6 - a)) * (factorial(6) / factorial(6 - b)) * (factorial(7) / factorial(7 - c)) * (factorial(5) / factorial(5 - books))
total_schedules <- total_schedules + newNumber
}
}
}
}
}
print(total_schedules)
## [1] 30004473600
Note: For answer B, I assumed that part A was no longer applicable. I only considered that he wants all 6 plays and the others did not matter.
total_books <- 13
total_schedules <- 0
for (a in 0:6) {
for (c in 0:7) {
for (books in 0:5) {
if (a + 6 + c + books == total_books) {
# Calculate the contribution of this combination
newNumber <- (factorial(6) / factorial(6 - a)) * (factorial(7) / factorial(7 - c)) * (factorial(5) / factorial(5 - books))
total_schedules <- total_schedules + newNumber
}
}
}
}
print(total_schedules)
## [1] 1604880
# You can only get 5 sycamores then 5 cypress or 5 cypress then 5 sycamores. . . so you must have (2 * all possible arrangements in those orders) / all possible arrangements
# All possible arrangements = factorial(number of spaces)
(factorial(5) * factorial(5) * 2) / factorial(10)
## [1] 0.007936508
((44 / 52) * -16) + ((8 / 52) * 4)
## [1] -12.92308
(833 * (44 / 52) * -16) + (833 * (8 / 52) * 4)
## [1] -10764.92