Find new year's days whose dates are prime numbers and whose previous dates are also prime numbers.
library("numbers") # to use "isPrime" function | |
# Prepare dates | |
year <- 1000:2999 | |
nyeve <- as.integer(paste0(year, "1231")) | |
ny <- as.integer(paste0(year + 1, "0101")) | |
# Output | |
bool_successive <- isPrime(nyeve) & isPrime(ny) | |
cat(paste(nyeve[bool_successive], ny[bool_successive], sep = ", "), sep = "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Result