Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 53 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

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
WalmartBag: can someone pls give me a proxy
1 minute ago 2 Replies 0 Medals
Breathless: womp
1 hour ago 0 Replies 0 Medals
Breathless: yo who wanna match pfp?
1 hour ago 11 Replies 1 Medal
Ylynnaa: This was long time ago lmk if u fw itud83dude1d
5 hours ago 17 Replies 2 Medals
abound: Wow question cove really fell off
7 hours ago 6 Replies 1 Medal
ayden09: chat i love black pink hehe i like jones to
6 hours ago 20 Replies 2 Medals
kamani7676: help
1 day ago 5 Replies 1 Medal
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!