Sha256: 172494d923f699ae3f5702e72a68dc52c6b5715a18d0bb47837b8cd41a61d199
Contents?: true
Size: 274 Bytes
Versions: 171
Compression:
Stored size: 274 Bytes
Contents
sieve <- function(limit) { if (limit < 2) { return(c()) } nums <- rep(TRUE, limit) nums[1] <- FALSE for (i in 2:limit) { if (nums[i]) { div <- floor(limit / i) if (div > 1) { nums[i * 2:div] <- FALSE } } } which(nums) }
Version data entries
171 entries across 171 versions & 1 rubygems