One of those recurring problems requires efficiently calculating and testing for prime numbers.
The first algorithm that comes to mind is The Sieve of Eratosthenes.
The Sieve of Eratosthenes
The Sieve, is one of many prime sieves, and is a simple yet time efficient algorithm for finding all the primes below a certain limit.
A prime number is a natural number that has exactly two distinct natural number divisors: 1 and itself.
Make note that we do not consider 1 a prime number albeit also not being composite.
The #1 tech hiring platform