# Php prime number algorithm

##### *2019-11-22 15:23*

Sieve of Eratosthenes: algorithm steps for primes below 121 (including optimization of starting from prime's square). In mathematics, the sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to any given limit.Prime sieves. A prime sieve or prime number sieve is a fast type of algorithm for finding primes. There are many prime sieves. The simple sieve of Eratosthenes (250s BCE), the sieve of Sundaram (1934), the still faster but more complicated sieve of Atkin (2004), and various wheel sieves are most common. php prime number algorithm

This program will generate all of the prime numbers from 1 to n Enter the value of n: 100 Enter '1' to generate them by testing each number's possible divisors, or '2' to generate them using the Sieve of Eratosthenes: 2 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 Generating the list above took 1 millisecond.