*Online computation of the first
primes and twin primes*

Using the famous *Sieve of Eratosthenes *(discovered by the Greek Eratosthenes
276 BC-194 BC), it is possible to perform an __online computation__ of
the first prime numbers with a small *JavaScript*
program (you can view the source of this program using a command like *View/Source
*in your browser). Therefore your browser must support *JavaScript* if you want to test this
small application! At the end of the array of primes, the number p(*x*) of primes less
than *x* founded is given. The primes may be computed up to
*x *= 50000 (it may take a few seconds to perform) but this bound can be increased inside the program.
A nice interactive illustration of how the Eratosthenes' sieve works
may be found here
(also in JavaScript).

*Compute primes*

*To compute the first primes click on the *__Compute
primes__ button

If you change the default number of primes click again on the **Compute
primes** button to update the array of primes. If the number of searched primes is
important it may take a few seconds to get the result of the computation.

*Compute twin primes*

The same method allows to compute the twin primes, that is
consecutive primes distant of 2. For example, 11 and 13 are twin primes. The number
p_{2}(*x*) of twin
primes less than x and the computation of
Brun's
constant (that is the sum of the inverse of the twin primes) are also given at the end
of the file. To find p_{2}(*x*) for large values of *x* (say up to
10^{15} or more), note that most algorithms are variants of Eratosthenes'
sieve.

*To compute the first twin primes click on the *__Compute
twin primes__ button

If you change the default number of twin primes click on the **Compute twin primes**
button to update the array of twin primes.