A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

Can some1 tell me whats wrong with this answer for 1a? Cheers pprime = 5 primen = 3 fdiv = 2 while primen<1001: if (pprime%fdiv == 0): pprime = pprime +2 if (pprime %fdiv>0) and (fdiv<(pprime/2)): fdiv=fdiv +1 else: print pprime print primen pprime= pprime +2 primen= primen +1

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    edit, just had a quick scan and picked some errors out however stil not right, here: pprime=5 #pprime is potential prime number primen=3 #associated prime number, where 2 is 1, and 3 is 2. fdiv=2 #first division while primen <1001: if (pprime%fdiv == 0): pprime=pprime + 2 if (pprime%fdiv>0) and (fdiv <=(pprime/2)): fdiv=fdiv+1 else: print pprime print primen primen=primen+1 pprime=pprime+2 fdiv=2 it goes through the cycle but must pickup some none prime numbers, as the 1000th coming up is not right.... going to sleep on it as i havent slept for 24 hrs and cant be good, cheers

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    You're exactly one line away from being finished. When a pprime turns out to not be prime, what do you want to start dividing the next pprime by?

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    oh my god, when i got up today i realised after reading your comments, i wrote everything down and realised my mistake when gettin to the number 9 as you can probably tell why, all done now, might get a little creative and try and get the user to input which prime they wish to see andcall just that one back (trying to use nothing more then whats being taught so far), as iv done my 2 lessons for the week, and i want it to really sink in and not rush. Somnamniac, im very greatful for the help!!! your a lifesaver! Just got to figure how to understand part b now haha,

  4. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.