Sha256: 3eb04b06388004d4b70e86b5f8c0b50fc4c9cf88e2b924ba33087fbee3ee13c5
Contents?: true
Size: 302 Bytes
Versions: 111
Compression:
Stored size: 302 Bytes
Contents
package sieve func Sieve(limit int) (primes []int) { c := make([]bool, limit+1) for p := 2; p <= limit; { for i := p + p; i <= limit; i += p { c[i] = true } for p++; p <= limit && c[p]; p++ { } } for i := 2; i <= limit; i++ { if !c[i] { primes = append(primes, i) } } return }
Version data entries
111 entries across 111 versions & 1 rubygems