Tutorials  Articles  Notifications  Login  Signup

Introduction What is binary number system Convert a number from decimal to binary Verify a Prime number - Trial division method Sieve of Eratosthenes - Finding prime numbers Finding all factors of a number Prime factorization of a number GCD using Euclid's algorithm Area of polygon Direction of a point from a line segment


Mathematics for Programmers - Sieve of Eratosthenes - Finding prime numbers







Video credits : mycodeshool

Sieve of Eratosthenes, is a simple, ancient algorithm for finding all prime numbers up to any given limit.

It finds prime numbers by iteratively marking the multiples of each prime, starting with the first prime number, 2. The multiples of a given prime are generated as a sequence of numbers starting from that prime, with constant difference between them.

Here is an illustration of how it works.

 

Sieve of Eratosthenes

 


No problems available for this topic.




HackerFriend Logo

Join the community of 1 Lakh+ Developers

Create a free account and get access to tutorials, jobs, hackathons, developer events and neatly written articles.


Create a free account