Here is JavaScript code to generate a list of an arbitrarily large number of prime numbers.īecause this is JavaScript, you can even open up your browser's JavaScript console and run this code for yourself. Prime numbers are the numbers which have only 2 factors, that is,1 and the number itself. How to Create a List of Primes Using the Sieve of Eratosthenes An illustration of how the Sieve of Eratosthenes Works step-by-step.
I assembled this list for my own uses as a programmer, and wanted to share it with you.īefore I show you the list, here's how to generate a list of prime numbers of your own using a few popular languages. Here's a list of all 2,262 prime numbers between zero and 20,000. What is a prime number 70 7 x 5 x 2 Prime Numbers: 2, 7, 17, 29, 41, 67 Composite Numbers: 12, 21, 32, 82 Twinkl Top Tip: When learning to understand how.