A community for students.
Here's the question you clicked on:
 0 viewing
13yrsold
 4 years ago
How do you compute prime numbers
13yrsold
 4 years ago
How do you compute prime numbers

This Question is Closed

kgiax
 4 years ago
Best ResponseYou've already chosen the best response.2You check to see if the only number that can divide evenly into it are 1 and itself.

dmancine
 4 years ago
Best ResponseYou've already chosen the best response.0That'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 itself1 DON'T divide it. (You can actually stop before itself1, 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.

kgiax
 4 years ago
Best ResponseYou've already chosen the best response.2Yeah 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 reread the material/rewatch the lecture. It's way too broad a question, is what I'm nitpicking basically.

dmancine
 4 years ago
Best ResponseYou've already chosen the best response.0Yes, 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.
Ask your own question
Sign UpFind more explanations on OpenStudy
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.