Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 12 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!
Latest Questions
Arriyanalol: i need help
2 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
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!