Prime Goodness

Still on my Project Euler craze, problem seven teaches something. This problem requires you to provide the 10001th prime number. I posted my C++ solution here. Feel free to modify it; but please do share when you are done.

The source code version you download from here only prints out the nth prime number requested. But originally, for observational purposes, it printed out all primes from 2 to n. Graphing the relationship (n, nth prime) gave the following equations

  1. With n = 50, after interpolating the points, this relationship emerged: y = 0.3059 + 2.0524x + 0.0832x² – 0.0006624x³. It is polynomial in nature
  2. With n = 10001, the relation changed to y = 10.6605x – 3691.2492. The application computing these numbers reached its sigularity point and reverted to a linear relationship – which is far from correct.

The graph though looks like a tangent function that has it’s origin offset, scaled in width down to about 60% and has been rotated some 20˚ clockwise. This busts the myth that prime numbers get exponential after a couple of increases. The study continues.

Advertisements

Share your knowledge

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