Problem 46117. Test approximations of the prime counting function
Cody Problem 241, which is based on Project Euler Problem 7, asks us to identify the Nth prime number. That is, the problem seeks the inverse of the prime counting function
, which provides the number of primes less than or equal to n. The Prime Number Theorem gives approximate forms of
for large n. Two such approximations are
and the offset logarithmic integral
, where
(See Cody Problem 46066).
Test these approximations by computing two ratios:
and
. Do not round the approximations to integers. For
, you will find that the first approximation is about 13% low and the second is about 16% high. However, for
, the first approximation is 6% low and the second is only 0.01% high.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers16
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
52122 Solvers
-
377 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
636 Solvers
-
Without the French accent please!
225 Solvers
-
Create logical matrix with a specific row and column sums
335 Solvers
More from this Author315
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!