Question 10, Find the probability that among 10,000 random digits the digit 3 appears not more than 931 times.

n<-100000
trials<-rep(NA, n)

for(i in 1:n){
  temp<-sample(c(0:9),10000, replace=TRUE)
  count<-length(temp[temp==3])
  trials[i]<-count
}


hist(trials)

Mean_trials <- mean(trials)
sd_trials <- sd(trials)
pnorm(931, mean=Mean_trials, sd=sd_trials, lower.tail = TRUE)
## [1] 0.01085193