Sha256: f1f922e9d9e77d7376ca0484eda79aa10f1fdbf49d3e065116d314ef23cbac08

Contents?: true

Size: 289 Bytes

Versions: 79

Compression:

Stored size: 289 Bytes

Contents

module Sieve

let rec private sieve remainder primes =     
    match remainder with
    | [] -> primes |> List.rev
    | p::xs -> sieve (xs |> List.filter (fun x -> x % p > 0)) (p :: primes)
    
let primes limit = 
    let possiblePrimes = [2 .. limit]    
    sieve possiblePrimes []

Version data entries

79 entries across 79 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.179 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.178 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.177 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.176 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.175 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.174 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.173 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.172 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.171 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.170 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.169 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.167 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.166 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.165 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.164 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.163 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.162 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.161 tracks/fsharp/exercises/sieve/Example.fs
trackler-2.2.1.160 tracks/fsharp/exercises/sieve/Example.fs