How do you generate prime numbers?

Click to regenerate

There are a number of ways to generate primes. One of the oldest is known as the ‘Sieve of Eratosthenes’, named after the Greek mathematician and scholar (who also invented a system of latitude and longitude). Here’s how it works – Starting from the No.2 – the smallest prime – you write down each consecutive number up to your chosen maximum. Now eliminate every multiple of 2; the first number that is missed out from this process will be the next prime – No.3. Now delete each multiple of 3, and repeat. Those left out each time are the primes.

This entry was posted in Deskarati Q&A, Mathematics. Bookmark the permalink.

One Response to How do you generate prime numbers?

  1. Phil Krause says:

    If you could write an algorithm or program that could predict the next prime from any number, you would soon become the most famous person that ever lived. Riches would follow.

Comments are closed.