[R] Need help in R

Greg Minshall m|n@h@|| @end|ng |rom um|ch@edu
Wed Oct 27 05:29:17 CEST 2021


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!



More information about the R-help mailing list