Generate Prime Numbers
Quickly generate a list of primes. Runs entirely in your browser, so your data never leaves your device.
Runs on your device, nothing uploaded
Output
Generating…
This runs entirely on your device
Generate Prime Numbers is JavaScript that your browser has already downloaded, and it does the whole job on your own machine. Nothing is requested from a server, so the result you see has never existed anywhere but here.
- No server involved
- Generated on your device
- Works offline once loaded
- Nothing stored or logged
How to use Generate Prime Numbers
- 1. Set how many primes. Enter How many primes to decide the length of the list, from a short set for a quick lesson up to a longer run for testing a factoring script.
- 2. Set the starting point. Enter Start from to choose where the search begins, whether that is 2 for the classic sequence or a larger number to find primes starting further along the number line.
- 3. Choose a separator and copy. Set Separator to a comma or newline, then copy the finished prime list into your worksheet, spreadsheet or code test.
When to use Generate Prime Numbers
Generate Prime Numbers uses a sieve to produce a list of primes starting from any point you choose. Use it whenever a lesson on factoring, a cryptography exercise or a test suite needs a verified list of primes without running a sieve yourself.
- Teaching prime factorization. A teacher preparing a worksheet on prime factorization wants a printed list of primes for students to reference while breaking numbers down into their prime components.
- Testing a primality checking function. A developer who wrote an isPrime function validates it against a known list of primes to confirm the function correctly identifies every one of them as prime.
- Choosing primes for a hash table size. Someone implementing a hash table that performs better with a prime-sized bucket array pulls a prime near their target size from a generated list.
- Exploring prime gaps starting from a large number. A number theory enthusiast curious about the spacing between primes near a large starting value uses the Start from option to see how gaps widen further along the number line.
Examples
The first ten primes
Output
2, 3, 5, 7, 11, 13, 17, 19, 23, 29
Primes between 1 and 100
Output
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
About the Generate Prime Numbers tool
Generate Prime Numbers does its work locally, right in the browser. Quickly generate a list of primes. There is no upload step, no queue and no account, and your data never travels over the network.
It belongs to the Math Tools collection on EditSafely, a set of 234 small, focused Math utilities that share the same instant, private workspace.
You can shape the output with 6 settings, including List, How many primes, Start from and From, and the result refreshes the moment you change one. 2 worked examples further down the page show exactly what the tool produces for real inputs.
Running locally also makes the tool fast and dependable: results appear as soon as your input does, there is no server outage that can take it down mid-task, and confidential data can be processed without a second thought.
Frequently asked questions
Is Generate Prime Numbers free to use?
Yes, it is completely free. All 2,943 tools on EditSafely work without an account, a subscription or usage limits.
Does the generator send anything to a server?
Everything happens locally. Your browser downloads the tool's code once, then does all the processing itself; nothing you enter is transmitted, stored or logged. You can even go offline after the page loads and it will still work.
How do I get a different result?
Change a setting. The result is worked out from the settings alone, so the same settings always give the same result, and a change shows up immediately.
Do I need to sign up or install anything?
No. The tool works in any modern browser on desktop, tablet or phone. There is no account to create, no extension to add and no software to install.
How do I use the result?
The output panel has a one-click Copy button, and Download saves the result as a file.