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. http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset1a.pdf
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.
Join our real-time social learning platform and learn together with your friends!