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
- With n = 50, after interpolating the points, this relationship emerged: y = 0.3059 + 2.0524x + 0.0832x² – 0.0006624x³. It is polynomial in nature
- 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.