Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
WilsonWorla
Group Title
prime_count = 1
start_number = 2
number_to_check = 2
while prime_count <= 1000:
result = number_to_check % start_number
if result > 0:
start_number +=1
elif result == 0:
if start_number == number_to_check:
print(number_to_check)
number_to_check +=1
prime_count +=1
start_number =2
else:
number_to_check +=1
start_number = 2
how can i modify this code to end at 1000?
 one year ago
 one year ago
WilsonWorla Group Title
prime_count = 1 start_number = 2 number_to_check = 2 while prime_count <= 1000: result = number_to_check % start_number if result > 0: start_number +=1 elif result == 0: if start_number == number_to_check: print(number_to_check) number_to_check +=1 prime_count +=1 start_number =2 else: number_to_check +=1 start_number = 2 how can i modify this code to end at 1000?
 one year ago
 one year ago

This Question is Closed

Matrix65 Group TitleBest ResponseYou've already chosen the best response.0
ur first control statement must be a for loop instead of while loop for (int i=1;i<=1000;i++)
 one year ago

UofIMechEng Group TitleBest ResponseYou've already chosen the best response.0
You don't necessarily need to make it a forloop.
 one year ago

LoveMathFermat Group TitleBest ResponseYou've already chosen the best response.0
Hi! I tried this code. It worked well. It stopped at 1000th prime number which is 7919.
 one year ago

Matrix65 Group TitleBest ResponseYou've already chosen the best response.0
are you answered?
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.