This Javascript calculates the number of prime numbers less than or
equal to n using the Sieve of
Eratosthenes algorithm.
An estimated number is given by n/(log n - 1), which is related to
the prime
number theorem.
The script also gives an example of Goldbach's
conjectures. Goldbach's strong conjecture states that any even
number can be expressed as the sum of two prime numbers, and
Goldbach's weak conjecture states that any odd number can be
expressed as the sum of three prime numbers. I have a rather elegant
proof of these conjectures, but don't have enough room to write it
down here.
As an added bonus, a list of the prime factors is provided for the
composite numbers.