Updated the algorithm to use a sieve rather than calling isPrime() for every number.

This pull request has been automatically generated by prose.io.