Bug fix in the prime library. Adding two more implementations with optimizations.