You are viewing a single comment's thread. Return to all comments →
Can someone help deduce a formula to calculate the number of Prime Numbers that comes before a certain number, say x.
The closest i could reach was with an approximate function f(x) as:
f(x)=x/(log x -1);
This wiki article is quite comprehensive https://en.wikipedia.org/wiki/Prime-counting_function
and also quite complex. Good luck on reading through it!!!
My feeling is that there is no way to exactly know how many prime numbers there are less that a certain number without actually generating the prime numbers themselves. You can aproximate the number of primes but you would never be able to know exactly without generating the numbers. My reasoning behind this is that as far as I know there is currently no formula to generate the nth prime number and since there is no formula then there would be no way to accurately (that is exactly) say how many of them there are.
But I'm no mathematician, and I'm sure others on this forum are way smarter than I am and would be able to lead you in the proper directions or share some other insights. I'm just using plain old common sense in my reasoning above.
Thanks for getting back. I am very well convinced that in order to find the exact number of primes that occur before a given number is only possible by generating them. Checked out the link above, but the results show that those functions give close but approximate results only. I guess i will figure out a way for that. Thanks again.