Course of Raku / Addendum 🆕 / Bringing it together / Mixed mini-projects / Exercises

Sieve of Eratosthenes

Problem

Use the sieve of Eratosthenes to find all prime numbers up to 30 and print them. Start by assuming every number is prime, then cross out the multiples.

Example

The program prints:

(2 3 5 7 11 13 17 19 23 29)

Solution

✅ See the solution

Course navigation

← Solution: Group the anagrams   |   Solution: Sieve of Eratosthenes →