what are the bounds for the assignment? are you expected to take in numbers up to a certain digit count?
the most dumb way is to check for divisors starting from the input/2, then looping down to 2. there are other, better heuristics you can employ to shorten the computation, but there is no catchall function for testing primeness of any arbitrary number.
http://en.wikipedia.org/wiki/Primality_testThis post was edited by irimi on Oct 2 2013 03:03pm