Welcome To Tutorialspoint.dev
Officially launched 18th May 2019

# Prime Factorization using Sieve O(log n) for multiple queries

We can calculate the prime factorization of a number &#x201C;n&#x201D; in O(sqrt(n)) as discussed here. But O(sqrt n) method times out when we need to answer multiple...

# Sieve of Eratosthenes

Given a number n, print all primes smaller than or equal to n. It is also given that n is a small number. Example: Input : n =10 Output : 2 3 5 7 Input : n = 20 ...

# Sieve of Sundaram to print all primes smaller than n

Given a number n, print all primes smaller than or equal to n. Examples: Input: n = 10 Output: 2, 3, 5, 7 Input: n = 20 Output: 2, 3, 5, 7, 11, 13, 17, 19 We have ...

# Segmented Sieve

Given a number n, print all primes smaller than n. For example, if the given number is 10, output 2, 3, 5, 7. Recom...

# Sieve of Eratosthenes in 0(n) time complexity

The classical Sieve of Eratosthenes algorithm takes O(N log (log N)) time to find all prime numbers less than N. In this article, a modified Sieve is discussed that w...

# Sieve of Atkin

Given a limit, print all primes smaller than or equal to the given limit. Examples : Input: limit = 10 Output: 2, 3, 5, 7 Input: limit = 20 Output: 2, 3, 5, 7, 11...