Question 1

How many prime numbers are there between 50 and 59 inclusive?

# install.packages(c("comprehenr","pracma"))
library(comprehenr)
## Warning: package 'comprehenr' was built under R version 4.5.2
library(pracma)
prime_nums <- to_vec(for (x in 50:59) if (isprime(x)) x)
cat("There are",length(prime_nums),"prime numbers between 50 and 59 inclusive.")
## There are 2 prime numbers between 50 and 59 inclusive.

Question 2

In the game of roulette, a horizontal spinner (the roulette wheel) is spun so that a small ball can land at random in any one of the 28 grooves. Oswald spun the spinner and waited until the ball settled in a groove. What is the probability that the ball landed on a black odd number?

# install.packages("bedrock")
library(bedrock)
## Warning: package 'bedrock' was built under R version 4.5.3
## 
## Attaching package: 'bedrock'
## The following objects are masked from 'package:pracma':
## 
##     logit, primes
roulette_set <- Roulette # part of the bedrock package
counter <- 0
N <- 1e5
for (i in 1:N) {
  spin <- roulette_set[sample(nrow(roulette_set),1), ]
  if (spin$col == "black" && spin$parity == "odd") {
    counter <- counter + 1
  }
}
probability <- counter / N
cat("The probability is:",probability,"\n")
## The probability is: 0.21519