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?
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.
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?
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.
Join our real-time social learning platform and learn together with your friends!