Consecutive Prime Sum — Project Euler (Problem 50)

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:

ProjectEuler50

Here’s how I did it:

Answer: 997651

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s