0

I have been surfing on the internet and found an interesting video in which is mentioned that you can find number of primes between 1 and any number n using Riemann hypothesis and Riemann zeta function. My math knowledge is not this high and I don't understand how, using zeta function, can one find number of primes.

I wanted to write a program that takes one number as input and outputs number of primes to that number, which is calculated using aforemention zeta function, but I have no idea where to start learning. Please know that I'm 17 years old and have always loved math and programming but this is something totaly new to me. Any help is apreciated.

  • 3
    You might get better results with receiving an answer on another stack exchange site. Stack Overflow is not for "how to I write this code" questions, it's for "I've written this code and it doesn't work; here are my expectations and here's what I'm receiving instead" questions. – mah Mar 11 '14 at 17:31
  • The exact number of primes in a range typically requires that you explicitly count (enumerate) the primes. You might be more interested in the *bounds* of the [prime counting function](http://en.wikipedia.org/wiki/Prime-counting_function). – Brett Hale Mar 11 '14 at 17:51
  • @BrettHale I could find primes and count them, but I want to use Riemann zeta function. Also I don't want to generate primes I want number of them. – user314159265 Mar 11 '14 at 18:05
  • 1
    "I don't understand how to write a program" is a fact, not a question. This is a question-and-answer site about *programming*. When you have a *specific* question about *code* come on back and people will be happy to help you. – Eric Lippert Mar 11 '14 at 18:57
  • If you want the *exact* number of primes less than n then you're going to have to count them. If you want an *approximate* number of primes less than n, it's `n / log n`. – Eric Lippert Mar 11 '14 at 18:59
  • 2
    I would also both encourage you to continue your exploration of the prime numbers while cautioning you that *understanding the zeta function is hard*. You should have an *extremely* solid grasp of complex numbers, exponentiation of complex values, integral calculus and analysis (the study of power series), before you dive into trying to understand the roots of the zeta function and the consequences of the Riemann Hypothesis. I personally never made it far enough into analysis to have a solid understanding of the zeta function. – Eric Lippert Mar 11 '14 at 20:28

1 Answers1

2

There are some formulas, but the best we have so far is only asymptotic estimates.

It is shown that if we denote with π(n) the number of primes that do not exceed n then the fraction:

π(n) * ln(n) / n

can be arbitrarily close to 1.
This is the prime number theorem.

gliderkite
  • 8,828
  • 6
  • 44
  • 80