Home

Primes

This page calculates all the primes up to your number

The page uses javascript. Depending on your browser, it may take a few seconds to find all the primes up to numbers over 1000. Your browser may report problems if you try to find primes up to a million or more. Google Chrome seems to be fastest with this javascript.

Enter a number:

This form does not test for sensible sized numbers or non-numeric input. You are welcome to see what happens if you enter very large numbers.

Javascript

Javascript is a programming language, with the usual "for" and "while" loops, conditional statements, some basic maths functions and so on. Because javascript is executed by the browser, it uses your cpu time, rather than the web server's cpu time. The code used on this page is very similar to (for example) PHP, Python or Perl code which would make the same calculations and output the same list, using the web server's cpu. You can view the javascript on this page by right-clicking and choosing view source. [Pages written in PHP cannot be viewed in this way.]