Bert,

> findprm <- function(n){
>    nn <- seq.int(2, n)
>    i <- 2
>    while(i <= floor(sqrt( n))){
>       nn <- nn[(nn <= i) | (nn %% i > 0)]
>       i <- nn[nn > i][1]
>    }
>    nn
> }

+1 -- thanks!

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to