CPRIME - Prime Number Theorem
English | Vietnamese |
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) %.
Input
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.
Output
For each value of x, output the percent error of the estimation of π(x), rounded to 1 decimal digit.
Example
Input: 10000000 2 3 5 1234567 0 Output: 6.6 188.5 36.5 3.6 7.7
Added by: | Jimmy |
Date: | 2008-12-11 |
Time limit: | 1.812s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | Tic Tac Toe |