Noori Selina

Discussion 10 Response

This code calculates the proportion of the first \(n\) values of \(S_n\) (the total outcomes of die tosses) that are divisible by 7. It uses mathematical reasoning to find a limiting value for this proportion as the number of tosses (\(n\)) approaches infinity.

# Define function to compute proportion of Sn values divisible by 7
compute_proportion_divisible_by_7 <- function(n) {
  # Expected sum after n tosses
  expected_sum <- (1 + 2 + 3 + 4 + 5 + 6) * (n / 6)
  
  # Limiting value for the proportion
  proportion_limit <- floor(expected_sum / 7) / n
  
  return(proportion_limit)
}

# Number of tosses
n <- 10000

# Compute and print the proportion limit
proportion_limit <- compute_proportion_divisible_by_7(n)
cat("Limiting value for the proportion of the first", n, "values of Sn divisible by 7:", proportion_limit, "\n")
## Limiting value for the proportion of the first 10000 values of Sn divisible by 7: 0.5