Write a C program that computes and prints out an approximate number of primes not exceeding a given number, x .

Status
Not open for further replies.
Oct 1, 2018
1
0
10
The Prime Number Theorem: The ratio of the number of primes not
exceeding
x
and
x
/
ln
x
approaches 1 as
x
grows without bound.
(Here ln
x
is the natural logarithm of
x
)
Note that ln
x
= 2[(
x

1
x
+1
) +
1
3
(
x

1
x
+1
)
3
+
1
5
(
x

1
x
+1
)
5
+
···
] for
x
>
0
Compute lnx
using the series above as far as you can without getting
overflow issues and use it to estimate the number of primes based on
the Theorem above
 
Status
Not open for further replies.