#install.packages("combinat")
require(combinat)
## Loading required package: combinat
## 
## Attaching package: 'combinat'
## The following object is masked from 'package:utils':
## 
##     combn

Page 116 Q 22

How many ways can six indistinguishable letters be put in three mail boxes? Hint: One representation of this is given by a sequence |LL|L|LLL| where the |’s represent the partitions for the boxes and the L’s the letters. Any possible way can be so described. Note that we need two bars at the ends and the remaining two bars and the six L’s can be put in any order.

Explain: Since there are two bars can place amoung 6 letters, it means there are 5 positions for two bars randomly placed.

comb = function(n, x) {
  factorial(n) / factorial(n-x) / factorial(x)
}
comb(5,2)
## [1] 10