Coding "The Sieve of Eratosthenes": An ancient algorithm for calculating prime numbers.

Опубликовано: 12 Февраль 2026
на канале: Exercism
3,001
97

In this video, we explore 7 different approaches to coding The Sieve of Eratosthenes. We look at solutions in C++, C#, Python, Raku, Julia, R and F#, looking at nested loops, lazy evaluation, and recursion.

Kick back and enjoy 30mins of learning with Jeremy and Erik, then go solve the exercise in your favourite way on Exercism.

Solve the exercise at: https://exercism.org/exercises/sieve
Join #48in24 at: https://exercism.org/challenges/48in24

Featured Solutions:
https://exercism.org/tracks/cpp/exerc...
https://exercism.org/tracks/csharp/ex...
https://exercism.org/tracks/python/ex...
https://exercism.org/tracks/raku/exer...
https://exercism.org/tracks/julia/exe...
https://exercism.org/tracks/julia/exe...
https://exercism.org/tracks/fsharp/ex...

Timestamps:
00:00:00 Introduction
00:03:55 C++: vector of booleans and nested for loop
00:07:28 C#: BitArray and lazy sequence
00:16:52 Julia: double comprehension
00:20:55 R: vector operation and optimized loop limits
00:25:17 Python: set difference of set of all numbers and set of multiples
00:27:33 Raku: symmetric set difference
00:32:40 F#: recursion with immutable list and range
00:33:44 Conclusion