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
0
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.
Thread starter Similar threads Forum Replies Date
M Apps General Discussion 2
H Apps General Discussion 3
Y Apps General Discussion 1
L Apps General Discussion 5
O Apps General Discussion 1
S Apps General Discussion 2
A Apps General Discussion 1
P Apps General Discussion 1
A Apps General Discussion 1
T Apps General Discussion 1
Y Apps General Discussion 1
I Apps General Discussion 2
T Apps General Discussion 1
S Apps General Discussion 2
P Apps General Discussion 1
M Apps General Discussion 6
U Apps General Discussion 2
V Apps General Discussion 5
P Apps General Discussion 1
S Apps General Discussion 1

Similar threads


ASK THE COMMUNITY