MIT 6.00 Intro Computer Science (OCW) 77 Online
OpenStudy (anonymous):

Hi, I could really do with a little advice on the second part of ps1. I am a graduate art student and my maths isn't too good. Due to this I'm not sure whether I'm handling the logarithm function in the right way. Every time I find a prime I add it to an empty var: logs = logs + math.log(primecand) Then I attempt to figure out the ratio between the logs and the number specified: if logs < primecount: ratio = primecount / logs else: ratio = logs / primecount print logs, primecount - 1, ratio Can anyone tell me if I've got the right end of the stick here? Thanks!

OpenStudy (anonymous):

you don't need the if/else statement - you are only interested in one ratio. the ratio you are interested in is: (sum of the logarithms of primes less than n) to n or (sum of the logarithms of primes less than n) / n

Latest Questions
PureSoulless: Are these bots (except for Aeon) new?
1 hour ago 1 Reply 0 Medals
heartbrokfirstone: What is the meaning of the word "ambivalent"
5 hours ago 0 Replies 0 Medals
heartbrokfirstone: What does the word varies mean?
4 hours ago 5 Replies 1 Medal
Wolf95: Would you rather be a famous singer or the next Einstein? Why?
5 hours ago 24 Replies 4 Medals
jayfrmdAO: what 100 to the power of 8
7 hours ago 6 Replies 2 Medals