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

im having problems understanding why my program isn't working for ps1b. i succesfully programmed ps1a, and i think th eproblem is just that i dont understand the question. could someone please help? heres the code: #Frist 1000 Prime number from math import * #intiating variabbles, i started x at 4 because it helped with 3 being prime, sol = sum of log sol = log(2) order = 1 primes = 3 x = 4 limit = raw_input ('How many prime numbers do you want to add?') #Printing 2 because it doesnt follow the pattern of regular primes order = order + 1 while (order

OpenStudy (anonymous):

sorry, let me post the file

OpenStudy (anonymous):

there we go.

OpenStudy (anonymous):

Its kind of hard to tell what is going on in your code. Just the initial variables kind of confuse me.you start your sum of logs at log(2) but your primes at 3. Also your divisor x keeps jumping around (4 ->5-> 2...) and kind of seems like you are changing them to fit the way the code works rather than changing the code to fit the way the numbers work. I've attached my code. Hope it helps!

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!
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!