Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 9 Online
OpenStudy (anonymous):

how do you test for primality in java. and if the input is not prime how do you output the product

OpenStudy (anonymous):

Use the modulus (%) operator. If 0 the number is even, if not it is odd. Discard number if even (and not 0, depending on how you look at it), then for all odd numbers write a recursive method that breaks down the number into its factors

OpenStudy (anonymous):

http://bit.ly/14hhKHQ

OpenStudy (anonymous):

For primality there are many different sieves that allow one to find prime numbers up to a given number; you can just use trial division and see if any of these divide your given number.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
2 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!