Back to Browse

Sieve of Eratosthenes Algorithm Visualization | Step by Step Python Code Animation

8 views
Apr 7, 2026
1:14

## Description Math Algorithm Sieve of Eratosthenes creates a boolean list (I made it binary for compact screen view) marking numbers from 0 to num as potentially prime, then iteratively marks multiples of each prime starting from p² as composite. The implementation returns a list of all prime numbers up to the given limit using list comprehension. *Complexity Analysis:* - Time Complexity: O(n log log n) — the inner loop marks multiples of each prime, and the sum of reciprocals of primes converges to log log n - Space Complexity: O(n) — requires a boolean array of size n+1 *Timestamps:* 0:00 — Input Validation And Initialize Prime Flags 0:09 — Main Loop Marking Multiples Starting From P Squared 0:58 — List Comprehension To Collect Prime Numbers and Return *Resources:* Telegram: https://t.me/benabub_algoviz GitHub: https://github.com/benabub Support channel: https://boosty.to/benabub

Download

1 formats

Video Formats

360pmp4852.2 KB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Sieve of Eratosthenes Algorithm Visualization | Step by Step Python Code Animation | NatokHD