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

Working on PS1 , Problem 1, this is what i have so far, but i can't seem to get the answer i'm looking for... http://dpaste.com/568876/

OpenStudy (anonymous):

well..the method in which u define prime seems wrong...check if 29 is a prime with ur method...

OpenStudy (anonymous):

yes it is....hm. can you describe how i should be doing this then?

OpenStudy (anonymous):

you should try dividing the prime candidate with all the odds less than the candidate..if there is any other divisor other than 1 n the candidate..that is a non prime.. and i meant square of 29 in the first post lol

OpenStudy (anonymous):

could someone simply walk me through the whole process of solving something like this? im a high school student who has NO experience whatsoever with programming.

OpenStudy (anonymous):

there is a question of kjs862...it has it all..take a look http://openstudy.com/groups/mit+6.0+intro+computer+science+%28ocw%29/updates/4e1e4aa60b8b4841c1aa3dc4

OpenStudy (anonymous):

great link sunu. I just wanted to add.. when I start writing code, I start by writing the easiest part first, and make sure it works, and add on. Later on, this might not be the best approach. But at the early beginner stage... so in this I first wrote a program that could determine whether or not a number was a prime, then i added finding the thousandth, then I adjusted it for efficiency. At each stage I made sure the code worked before starting the next one. And remember with programs, you have to think about being able to extend it for another problem... by that I mean, if you write a program that tells you if a number is a prime, it should be able to tell you any number within reason. You can't write x%2 and x%3 ... x%12330 etc for all the numbers, you have to use the loops.

OpenStudy (anonymous):

ok, that makes sense, but how do i make a loop? or a um...tuple?

OpenStudy (anonymous):

oh wait nevermind, i read the other post. thank you very much! i understand it now =)

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!