MIT 6.00 Intro Computer Science (OCW) 83 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
Tsukage: Whos the best hokage (based off of personality)?
11 minutes ago 21 Replies 1 Medal
velmalovesshaggy145: What do you want for Christmas?
13 minutes ago 11 Replies 0 Medals
rose12345: helpp needed
2 hours ago 10 Replies 1 Medal
Aphmau: Hey yall tonight is my concert any advice
3 hours ago 9 Replies 0 Medals