Skip to content

Instantly share code, notes, and snippets.

@thekvs
Created March 13, 2013 17:02
Show Gist options
  • Save thekvs/5154099 to your computer and use it in GitHub Desktop.
Save thekvs/5154099 to your computer and use it in GitHub Desktop.
Print all prime numbers less than 1000000
library(gmp)
p <- 1
while (T) {
p <- nextprime(p)
if (p > 1000000) {
break
}
cat(sprintf("%s\n", p))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment