Algorithm to find primes.

This is an efficient method to calculate prime numbers. It doesn't work for a really big n (memory runs out).