EditSafely

Generate Prime Numbers

Quickly generate a list of primes. Runs entirely in your browser, so your data never leaves your device.

Output

The result appears here as you type.

Options

How to use Generate Prime Numbers

  1. 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. 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. 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

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 3 settings, including How many primes, Start from and Separator, and the result refreshes the moment you change one. A worked example further down the page shows exactly what the tool produces for a real input.

Running locally also makes the tool fast and dependable: results appear as you type or drop a file, 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,658 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?

Run the generator again. Each run is computed fresh on your device, and any options you change are applied to the next result 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 you can keep refining the input while you work; the result updates in place as you type.

Related tools

All Math Tools