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

i need help with problem set 1 b!!! anyone??? :) tx

OpenStudy (anonymous):

This is what i got. Any comments? from math import * prime_candidate = 3 divisor = 2 prime_number = 2 given_number = 10000 partial_sum = log(2) print "2 is prime number 1" while prime_candidate <= given_number: while prime_candidate%divisor != 0: divisor=divisor+1 if divisor == prime_candidate: print prime_candidate, 'is prime' partial_sum = partial_sum + log(prime_candidate) prime_candidate = prime_candidate+2 divisor=2 else: prime_candidate = prime_candidate+2 divisor=2 else: print partial_sum, 'is the sum of all the logarithms of the' 'prime numbers between 2 and', given_number, print 'the previous sum.' print 'divided by', given_number ,'equals', partial_sum/given_number

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
KKMMTHING1: y do people call me den gts
17 hours ago 3 Replies 0 Medals
moonlight2004: Happy Thanksgiving everyone
1 day ago 5 Replies 1 Medal
idontexistrn1: Happy Thanksgiving
19 hours ago 8 Replies 0 Medals
Sleepypanda: Happy thanksgiving!! ud83eudd83
19 hours ago 12 Replies 5 Medals
Babybloomivf: How do I choose the right IVF center near me?
2 days ago 1 Reply 0 Medals
Babybloomivf: How do I choose the right IVF center near me?
2 days ago 0 Replies 0 Medals
ShikuniShigana: I'm making a lil analog horror thingy, what do y'all think of it?
2 days ago 10 Replies 1 Medal
xjacob: How can u solve x5 +y5+z5 I just need a little help
1 day ago 12 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!