Introduction

This report examines the behavior of combinations and permutations calculated for the first 10 prime numbers. We use custom R functions to compute combinations and permutations for various values of n and k, then plot the results to visually compare them.

Define Functions for Combinations and Permutations

We define two functions to compute combinations \(C(n, k)\) and permutations \(P(n, k)\) based on factorial formulas.

# Function to compute combinations C(n, k)
compute_combinations <- function(n, k) {
  return((factorial(n) / factorial(n - k)) * 1 / factorial(k))
}

hss

compute_combinations(10,2)
## [1] 45