Many problems in Project Euler relate to working with primes. I use primesieve-python to help solve such problems. It consists of Python bindings for the primesieve C++ library. Generates primes orders of magnitude faster than any pure Python code. Features:

- Generate a list of primes
- Count primes and prime k-tuplets
- Print primes and prime k-tuplets
- Find the nth prime
- Iterate over primes using little memory

Anyway, here’s Problem 50 from Project Euler:

Here’s how I did it:

**Answer:** *997651*

Advertisements