anonymous
  • anonymous
hi, i am having trouble with problem 2 of ps1. I keep either getting wrong numbers or nothing. Can someone please help me. Thanks This is what I have so far. import math answer=math.log(2) primecount=0 candidate=1 while primecount<999: candidate=candidate+2 divisor=3 not_prime = False while (divisor
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
sorry it didn't post the bottom but it ends with primecount= primecount 1 print answer
anonymous
  • anonymous
Were you able to do Problem 1? You only need to make some very minor changes to the solution for problem 1 to get it to solve problem 2. I'd reccomend starting with problem 1 and modifying it to solve problem 2. If you want some tips, copy and paste your problem 1 solution and I or somebody else here may be able to advise you.
anonymous
  • anonymous
this is my solution to problem 1, I would appreciate any help with problem 2. primecount=0 candidate=1 while primecount<999: candidate=candidate+2 divisor=3 not_prime = False while (divisor

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
Okay, I see what you've changed between the two. Get rid of the "while primecount<998 and not_prime == False:" at the end. Move "answer= answer + math.log(candidate)" into the last if statement. It should work then.
anonymous
  • anonymous
thanks, got it working

Looking for something else?

Not the answer you are looking for? Search for more explanations.