• anonymous
I have just started the 6.00 course and have watched the first 4 lectures. I have been looking at the 2nd Assignment and I am completely confused. Can anyone help me get started? The assignment is to write some code that will generate the 1000th prime.
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert
Hey! We 've verified this expert answer for you, click below to unlock the details :)
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.
  • jamiebookeater
I got my questions answered at in under 10 minutes. Go to now for free help!
  • anonymous
The key is to break the problem down into steps. Do not worry about finding the 1000th prime number at first. Start by creating code that can accurately test whether a number is prime. To do this you could write code that will take a number from the user and test it. This will require you to assign a variable to a number inputed by the user (This is similar to how you assigned variables in PS0 for first and last names based on user input.). Then create a prime number test that tests whether the number given by the user is prime. Once you achieve a working test for primality, you can begin to think about how to code your program to keep track of how many primes have been found and how to make it stop testing for primes once 1000 have been found.

Looking for something else?

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