anonymous
  • anonymous
HELP!! I'm stuck on ps1a. here's my code: http://dpaste.com/532527/ my reasoning behind the program is this: give prime the value 1. give even_number the value 2. set up a loop to repeat the process 999 times. add prime and even number to be new value for prime. check to see if prime can be evenly divided by numbers from 2 up to but not including prime. if it can be divided evenly by any number from 2 to but not including prime. keep adding 2 to even number and repeating until prime is not evenly divisible by 2 to but not including prime. after the loop is completed to obtain the prime make
MIT 6.00 Intro Computer Science (OCW)
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
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

anonymous
  • anonymous
oops my reasoning got cut, here it is is full: give prime the value 1. give even_number the value 2. set up a loop to repeat the process 999 times. add prime and even number to be new value for prime. check to see if prime can be evenly divided by numbers from 2 up to but not including prime. if it can be divided evenly by any number from 2 to but not including prime. keep adding 2 to even number and repeating until prime is not evenly divisible by 2 to but not including prime. after the loop is completed to obtain the prime make even_number equal 2 again. print prime.
anonymous
  • anonymous
my problem is that it won't let me divide by a tuple. any suggestions to get around this problem?
anonymous
  • anonymous
You cannot divide by a tuple. You can divide by numbers in a tuple if you like, but tuples are containers, not numbers.

Looking for something else?

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

More answers

anonymous
  • anonymous
You might want to try creating a list of primes since nonprimes cannot be divided evenly by primes.
anonymous
  • anonymous
polpak: what i was trying to do was, as you said, divide by the numbers contained in the tuple. I just can't figure out how to do it
anonymous
  • anonymous
for number in mytuple: if prime % number == 0: # prime is not prime.
anonymous
  • anonymous
ooooooooooh tats how you do it thanks
anonymous
  • anonymous
thats*

Looking for something else?

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