# Java Prime

### Here are a few primes

Here is a small program to find primes.
It is basically a sieve program. As it finds each prime it eliminates
all multiples of that number as possible primes. It will fill your
disk with primes.

source
first thousand primes found by this program
first million primes found by this program

### Mersenne primes

The biggest primes known are Mersenne Primes. Mersenne Primes are
primes of the form 2^n-1. They are easy to check as they can be found
by the Lucas-Lehmer test (see Knuth "Art of Computing v2). Here is a
program which checks a number n to see if 2^n-1 is prime. It can
be shown that for 2^n-1 to be prime a necessary condition is n is
prime. If only we had a list of primes to check.

source

a small driver

sample output