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

Hi everyone. I've put together the below code to find the 1000th prime number. One question I have, is it possible to change this code so that I can go on forever without breaks instead of sticking the arbitrarily large number in there? edit: Put the increment of the prime count in the right place. prime_count = int(0) for testing_number in range(2, 100000000): for checking_number in range(2, testing_number): if testing_number % checking_number == 0: break else: prime_count += 1 if prime_count > 999: print('1000th prime: ',testing_number) break print("Prime count:",prime_count)

OpenStudy (rsmith6559):

Have you considered making a list of the primes, and using a while loop?

OpenStudy (doc.brown):

Which language?

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!