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

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

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

MIT 6.00 Intro Computer Science (OCW)
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

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
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?
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,

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Not the answer you are looking for?

Search for more explanations.

Ask your own question