×
Home Discussions Write at Opengenus IQ
×
  • DSA Cheatsheet
  • HOME
  • Track your progress
  • Deep Learning (FREE)
  • Join our Internship 🎓
  • RANDOM
  • One Liner

prime number

A collection of 4 posts

Algorithms

Find all primes with Sieve of Sundaram

Sieve of Sundaram is an efficient algorithm used to find all the prime numbers till a specific number say N.

Vartika Yadav
Algorithms

Sieve of Atkin

Sieve of Atkin is an algorithm used to find all prime numbers upto a given number (say N) and does so in O(N) time complexity. With a modified version with enumerating lattice points variation, the time complexity goes to O(N / log log N). It is computationally efficient than Sieve of Eratosthenes

Drishti singh
Algorithms

Fermat's little theorem, a Probabilistic test for Primality

One of the most popular probabilistic algorithm for determining if a number is prime or not is based on Fermat's little theorem. The complexity of the algorithm is O(K log N) and fails only for Carmichael numbers which are composite numbers satisfying fermat little theorem starting with 561

Aswin G
Algorithms

Find primes using Sieve of Eratosthenes

Sieve of Eratosthenes is a simple and ancient algorithm (over 2200 years old) used to find the prime numbers up to any given limit. It is one of the most efficient ways to find small prime numbers. Implementations in C, C++, C Sharp, Java, Go, Haskell, JavaScript, PHP and Python.

Nilesh Jain
OpenGenus IQ © 2025 All rights reserved â„¢
Contact - Email: team@opengenus.org
Primary Address: JR Shinjuku Miraina Tower, Tokyo, Shinjuku 160-0022, JP
Office #2: Commercial Complex D4, Delhi, Delhi 110017, IN
Top Posts LinkedIn Twitter
Android App
Apply for Internship