# Problem: # f friends call (at random) on d days. # Find the probability that at least one friend calls on each day. # sim(f,d,nrep) uses a simulation to approximate the probability. # nrep is the number of simulation repetitions. # exact(f,d) computes the exact probability. # Define the functions sim() and exact(). sim<-function(f,d,nrep){ ans<-0 for(i in 1:nrep)ans<-ans+(0