on-internet
← Community

Generate a list of primes up to a certain number

Stack Overflow ·

I'm trying to generate a list of primes below 1 billion. I'm trying this, but this kind of structure is pretty shitty. Any suggestions? a <- 1:1000000000 d <- 0 b <- for (i in a) {for (j in 1:i) {if (i %% j !=0) {d <- c(d,i)}}}

Comments

Sign in or sign up to comment and upvote.

No comments yet.