algorithms.tutorialhorizon.com

Sieve of Eratosthenes - Find all Prime Numbers less than equal to N | Set 2 | Algorithms

Objective: Given a number N, Write a program to find all prime numbers which are between 0 and N using Sieve of Eratosthenes algorithm. Prime Number : A prime number is a natural number that has exactly two distinct natural number divisors: 1 and itself. Example: N = 10 Output: 2 3 5 7 N = 60 Output: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59