Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 13 Online
OpenStudy (anonymous):

Problem set 1, problem 2. Can someone explain a bit more about what problem 2 wants.

OpenStudy (anonymous):

They want you to write a program that computes the sum of logarithms of all primes from 2 to some number n. Then print out the sum the number and the ratio of these two quantities. The best place to start is to google both prime numbers and logarithm so you understand the question properly. Then once you understand what a prime and a log is do the problem by hand for a very small number carefully noting how you solve it. Write this out as an algorithm and then translate that algorithm to code.

OpenStudy (anonymous):

hint you will have to solve what a prime is from problem 1 to do this

OpenStudy (anonymous):

I completed the code for problem 1. Is problem 2 wanting me to add the logs of the primes together, eg: n = 3 sum = log(2) + log(3) + log(5) and then get the ratio by sum / n ? thanks for previously responding.

OpenStudy (anonymous):

yep you will have to use a loop to iterate up to n. When you run it you should see that the ratio gets closer to 1 as it goes.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Breathless: Spooky witch but cute
5 hours ago 3 Replies 0 Medals
Arriyanalol: help
5 hours ago 10 Replies 2 Medals
Arriyanalol: @tinydinoUwU stop trying to find a argument u blad lil boy
1 day ago 5 Replies 4 Medals
Jaded012023: Please tell me what you all think of this song
8 hours ago 6 Replies 1 Medal
Arriyanalol: bro how
8 hours ago 2 Replies 3 Medals
Arriyanalol: cant wait for the new bluey movie in 2027
1 day ago 12 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!