anonymous
  • anonymous
i am on lecture4 and atempting the first assignment. Im stuck on the first problem on how to write a program that prints out the first 1000th prime numbers. i'm guessing you have to use a for loop, but I'm just not sure how to actually go about writing the code for it.
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.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
The tutorial in the Python documentation gives examples of flow control tools http://docs.python.org/tutorial/controlflow.html#more-control-flow-tools try writing down in words what you need to do then see if you can translate that into code like: i need to test a bunch of numbers till i find 1000 primes to test a number i need to see if it is evenly divisible by any number between 2 and n-1
anonymous
  • anonymous
Like what bwCA said, just try to visualize what exact you want to do. You may even want to consider trying to find the first few prime numbers (besides 2 considering it said to skip it in the instructions because the test should be only concerned with odd numbers to make things easier for you) by hand. A hint though: it says use the remainders as a test (a%b). If something divides evenly into something other than 1 and itself, then it's not prime. I hope that helps, goodluck.
anonymous
  • anonymous
thank you, i figured it out.

Looking for something else?

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