You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deferatosthenes (n : Nat) : Array Bool := Id.run dolet mut isPrime := Array.mkArray (n + 1) true
isPrime := isPrime.set! 0 false
isPrime := isPrime.set! 1 false
for p in [2 : n + 1] doif not isPrime[p]! then
continue
let mut q := 2 * p
while q <= n do
isPrime := isPrime.set! q false
q := q + p
return isPrime
defrunTest (n : Nat) : IO Unit := dolet l := eratosthenes n
for i in [:l.size] doif l[i]! then
IO.print s!"{i} "#eval runTest 19
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: