Primes

Improved the implementation using tail-recursion. It is somewhat quicker
than before but more importantly it no longer causes
"OutOfMemoryException" for large N.