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

So I think I've identified my road block on the 1000th prime, is the lack of understanding the structure of the conditionals... what would be the right conditional to use?

OpenStudy (anonymous):

You have to check for divisibility. Hence, if numberBeingTested is not divisible by counter then it is not prime, and there is no need to check further.

OpenStudy (anonymous):

Thanks this is hanging me up too. I am trying to wrap my head around the division by subtraction algorithm. What related components could I do well to know about? How do I apply this in some kind of consequence as a structure?

OpenStudy (maitre_kaio):

Division by substraction ? You don't need that. To check if q is a factor of p, just test p % q == 0 To check if p is a prime, enumerate all the integers from 2 to p-1 and do the previous test. If it always fails, then p is a prime.

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!