Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Epic fail trying to solve π(x)

  1. Jun 15, 2012 #1
    Once again I've faced a complete dead end in trying to solve the pi function so I thought I may share my work so if anyone else wants to go down this road they can either know better, or finish what I couldn't.

    1. I wanted this graph to be continuous so I started under the assumption that π(0)=0 π(1)=1 π(2) =2 π(3) =3 π(4)=5 π(5)=7 etc.

    2. I built a linear calculator of π(x) which calculated all primes up to a target and indexed them, then to calculate a value for π(x) in a linear way I used a line function from π(floor(x)) to π(ceil(x)) and used that line to identify approximately where the real π(x) is.

    3. I took the possibility that π(x) could equal x^n so I attempted to calculate this n. The value was not constant so I chose n as 0.8427 . Visually this value when multiplied by a constant to adjust the angle would wrap around the actual value nicely for a short amount of time and would then curl downwards.

    4. After many failures in correcting this value I looked back at the prime number theory. According to the prime number theory as x->infinity x/ln(x) will approach the value of π(x). Since the accepted value of π(x) for this theory doesn't include 1 as a prime the graph of x/ln(x) should always be less than my function. So I built a formula to adjust the curl so that it would curl to x/ln(x) at some value largely above. I believe I tried (10^log(x)+1) so that for 10^3 the curl adjustment would cause my function to reach x/ln(x) when x - 10^4. The results looked promising. Up to 10^5 my error was less than +/- 50, and more amazingly the resulting error appeared to be a combination of sine waves.

    After reviewing the FFT of the final error I came to the assumption that I may have run into a cosine integral and therefore be unable to repair the remaining error. To clarify this, lower frequencies had higher amplitudes and fell off at a rate visually similar to 1/x as the frequency increased. I also ran extremely high known values through my formula such as 10^24 and found my error at that order had climbed to as high as 50%. While my method of calculating π(x) seemed promising in the end I was left with a formula which was two pages long and failed horribly for extremely large values. I believe that the reason my function had such a high error for extremely large values is due to the high amplitude of low frequency values which was showing in the FFT but since I was unable to identify a formula to adjust for this error I am sharing my findings in hope that someone can finish where I left off and solve the Pi function.

    - Ralph Ritoch
    Last edited: Jun 15, 2012
  2. jcsd
  3. Jun 19, 2012 #2
    http://www.claymath.org/millennium/Riemann_Hypothesis/1859_manuscript/EZeta.pdf [Broken]

    You may be interested in this paper. Riemann was a very stark writer, and leaves little explanation. Most of his work was in geometry, but his single foray into analytic number theory, the paper I have posted a link to, yielded an explicit formula for the nth prime number. This formula appears at the top of page 8. It is extremely complicated, but exact, and useful and interesting from a theoretical standpoint.

    Also, regarding your point 4: the prime counting function is *not* always less than x/lnx. Whether this was true was an open for a long time, but it has been proven that there exists a number for which x/lnx is greater than the prime counting function. There are two fascinating things about this number:
    1. It has not been computed exactly - only its existence have been proved, and some crude upper and lower bounds. These lower bounds place it on the order of magnitude of the number of particles in the universe. This is interesting because while the problem was open, there were two approaches: one was to compute values using massive computers and brute-force techniques, looking for a counterexample, and one was the theoretical work that ultimately succeeded. Since it is not possible even in theory to compute numbers that large on a physical computer, the proof in fact shows that the other technique would never has succeeded.
    2. It was further proved that x/lnx grows larger again, eventually, and then smaller, and then larger, and that the two alternate infinitely often as x goes to infinity.
    Last edited by a moderator: May 6, 2017
  4. Jun 19, 2012 #3
    My point is that this is a deep area of mathematics that's been studied for thousands of years. The last couple of centuries have seen incredible advances, and they have usually required extremely complicated and advanced theoretical techniques from complex analysis, modern algebra, and a whole slew of other fields.

    If this is something you're interested in learning about, pick up a book. John Derbyshire's Prime Obsession is a great introduction for the layman to the Riemann hypothesis, one extremely important open problem in number theory. It presupposes no mathematical background, but covers many of the technical aspects of the field quite comprehensively. The book would be great way to get some context for how such theoretical methods can be applied to these problems, and context can make it much much easier to grapple with theoretical ideas should you decide to study them more technically.
  5. Dec 10, 2012 #4

    Thank you for the information. I will certainly look into that book. I've been toying with the Pi function on and off for about 15 years. This is the first time I thought I had found a solution by chasing x/ln(x) but I wasn't aware of the information you provided about it. There is a very large probability that processing error had a lot to do with the error rates I was getting for extremely large numbers because I was simply using "double" floating point numbers.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook