CPRIME - Prime Number Theorem
In number theory, the Prime Number Theorem describes the asymptotic distribution of prime numbers. Let π(x) be the number of prime numbers not greater than x. The Prime Number Theorem states that:
Your task is to write a program to verify how well the Prime Number Theorem can estimate π(x). To be more precise, for a given x, you have to calculate the percent error |π(x) - x/lnx| / π(x) %.
The input contains several test cases (no more than 1000). Each test case contains a value of x (2 ≤ x ≤ 108) given in one line. A number 0 terminates the input.
For each value of x, output the percent error of the estimation of π(x), rounded to 1 decimal digit.
Input: 10000000 2 3 5 1234567 0 Output: 6.6 188.5 36.5 3.6 7.7