Start with the implementation of the Sieve of Erastosthenes: The program to comp
ID: 3534357 • Letter: S
Question
Start with the implementation of the Sieve of Erastosthenes:
The program to compute pi(n), which is the number of prime numbers < n. It will print out pi(n) for values of n that are powers of 10 from 10 to 10^8.
For example, pi(2) = 1 and pi(10) = 4. I
Output will be in four columns.
1) The first will contain n.
2) The second will contain pi(n)
3) The third will contain n/ln(n)
4) The fourth will contain the ration of pi(n) to n/ln(n).
An extremely important theorem of number theory says that as n goes to pi, the ratio of pi(n) to n/ln(n) converges to 1.
Explanation / Answer
#include #include #include int main() { float number = 0; float pi = 22/7; printf("Enter a number of your choice"); scanf("%d", number); float multiply = pi*number; float logarithm = (number/log(number)); for(int i =0 ; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.