number of digits of prime number |
problem:117 |
Time limit:1000ms |
Memory limit:65536k |
|
Description |
Xiao Ming is a clever boy and has a strong interest in number theory. He found that it was difficult to ask how many primes between 1 and 10n, and it was difficult to determine the size of the N value.Now the question is, tell you the value of N, let you help Xiao Ming calculate the number of primes less than 10n total number of bits. |
input |
There are several groups of input data, each set of data containing 1 integers n (1 < N < 1000000000), the processing ends if EOF is encountered. |
Output |
corresponding to each set of data, the number of digits less than 10n is output in one line, and the format is shown in sample output. The output of the same set of data, with a blank space between each mantissa, with no spaces at the end of the line. |
Sample_input |
3
7
|
Sample_output |
3
6 |
Topic Analysis:1. Prime number theorem
The difference between 2.floor and int, function floor () is rounded down, return double;int coercion type conversion, rounding to 0, that is, their negative number processing result is different
3. The large number of digits formula, which makes X=10^m (the integer part of M +1 is the number of digits of the large number x), has M=LG (x)
Reference Code:
#include
#include #include #include #include #include #include #define
MAXN 1500
using namespace std;
int main ()
{
//Freopen ("Input.txt", "R", stdin);
Double N;
while (cin>>n) {//prime theorem + large number of digits formula
double ans=n-log10 (n)-log10 (log (10.0));
cout<