Coding

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

2.578 Lượt nghe
Coding "The Sieve of Eratosthenes": An ancient algorithm for calculating prime numbers.
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/exercises/sieve/solutions/ErikSchierboom - https://exercism.org/tracks/csharp/exercises/sieve/solutions/ErikSchierboom - https://exercism.org/tracks/python/exercises/sieve/solutions/OlaPietka - https://exercism.org/tracks/raku/exercises/sieve/solutions/habere-et-dispertire - https://exercism.org/tracks/julia/exercises/sieve/solutions/pk - https://exercism.org/tracks/julia/exercises/sieve/solutions/pk - https://exercism.org/tracks/fsharp/exercises/sieve/solutions/erikschierboom 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