anonymous
  • anonymous
How do you compute prime numbers
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
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.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
You check to see if the only number that can divide evenly into it are 1 and itself.
anonymous
  • anonymous
That's the mathematical definition. As far as writing a program, you know that 1 and itself already divide it, so you check to see that each of 2 through itself-1 DON'T divide it. (You can actually stop before itself-1, but don't worry about that until you get your code working correctly.) And just a hint, first write the code to test if a single number is prime, and test it. THEN write the code that finds multiple primes.
anonymous
  • anonymous
Yeah I was just being a wiseass really. He said "compute" and that could really just be "how do I do it on a calculator". But even if he's asking how do you write a program that does it, the answer is the same: you write code that takes a number and checks to see if it only divides evenly by 1 and itself (though yeah, logically you'd do that in reverse like you said). If he doesn't know how to do that, either he should be more specific so we can answer the question better, or maybe he should just re-read the material/rewatch the lecture. It's way too broad a question, is what I'm nitpicking basically.

Looking for something else?

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

More answers

anonymous
  • anonymous
Yes, but his name says he's only 13, and I don't remember when I learned about prime numbers, but it's possible he doesn't know. Actually, I didn't read your response as wiseass. I guess I've learned to read things on the web as sincere. Either way, I think he knows what a prime number is now.

Looking for something else?

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