Project Euler – Problem 7

By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.

What is the 10 001st prime number?

Problem 7 is pretty easy too!

General Algorithm

  1. Begin testing numbers to see if they are prime, starting from 2.
  2. Break the loop when you have found 10001 prime numbers.

It’s that simple. 102,892 people have solved this problem.

Run time: 0.062 s.  Do let me know if you manage to make an improvement.

Solution in C++

Advertisements
Leave a comment

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

%d bloggers like this: