Sha256: 1195079a8d489a5df852fdaac30f5d6ec00c8ec8024ba0669cd00e9862d0274d

Contents?: true

Size: 334 Bytes

Versions: 310

Compression:

Stored size: 334 Bytes

Contents

function sieve(limit::Integer)
    limit <= 0 && error("Invalid limit")
    nums = fill(true, limit)
    nums[1] = false
    primes = []
    while (i = findfirst(nums)) > 0
        push!(primes, i)
        for j = find(nums)
            if j % i == 0
                nums[j] = false
            end
        end
    end
    primes
end

Version data entries

310 entries across 310 versions & 1 rubygems

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