Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Generating prime numbers in R
# Prime number generator in R Limit<-5000 # All prime numbers >3 are of the form 6*n+1 or 6*n-1, so we only need to check these numbers primeslist<-c(2,3) # List were we store the primes list<-c() # list were we store the numbers to check k<-1 x<-6*k+1 while (x <= Limit) { list<-c(list,x-2,x) k<-k+1 x<-6*k+1 } while(!length(list)==0) { y<-min(list) primeslist<-c(primeslist,y) list<-setdiff(list,list[list %% y==0]) } primeslist
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
16-09-2020ExPedro
Hernani
Ass2 q2
Paired t-test [ Zinc Concentration]
(.)(.)
Ch. 4 Boxplot Skewed Left
sentiment analysis
Learning
taylorsen7
10-08-2020Exe
Please log in to post a comment.