Question 1

Estimate how many whole numbers from 1 to 900 are divisible by 11.

# install.packages("comprehenr")
library(comprehenr)
## Warning: package 'comprehenr' was built under R version 4.5.2
divisible_by_11 <- to_vec(for (x in 1:900) if (x %% 11 == 0) x)
cat("There are",length(divisible_by_11),"whole numbers from 1 to 900 that are divisible by 11.","\n")
## There are 81 whole numbers from 1 to 900 that are divisible by 11.

Question 2

Write 9,514,293 in words.

# install.packages("english")
library(english)
## Warning: package 'english' was built under R version 4.5.2
words(9514293)
## [1] "nine million five hundred fourteen thousand two hundred ninety-three"

Question 3

A bag contains 3 red balls, 4 green balls, and 5 white balls. Valeria draws two balls without replacement. Find the probability that a green ball and red ball are picked at the same time.

bag <- c(rep("Red",3),rep("Green",4),rep("White",5))
counter <- 0
N <- 1e5 # 100,000 trials
for (i in 1:N) {
  pick <- sample(x = bag,size = 2,replace = F)
  if (("Green" %in% pick) & ("Red" %in% pick)) {
    counter <- counter + 1
  }
}
probability <- counter / N
cat("The probability that a green ball and a red ball are picked at the same time is:",probability,"\n")
## The probability that a green ball and a red ball are picked at the same time is: 0.18403