Binomial Series: Code

choose() and factorial() are functions in R

n <- 10
k <- 2
choose(n, k)
## [1] 45
factorial(k)
## [1] 2