OK, first semester in C# and just starting to work on it. Haven't programmed in a long time, kinda stumped on this one. The assignment is to determine if a number is prime, and if its not, to factor it. I know what a prime number is in my head, but I don't really know how to put that into code.
Thanks.
Name:
Anonymous2007-01-17 9:40
erm primality testing is a very hard question. there are no efficient algorithms for it atm.
Name:
Anonymous2007-01-17 11:56
>>12
Since we're handling ints, we can safely use Fermat's theorem and check for all Carmichael numbers in the int range.
Name:
Anonymous2007-01-17 13:24
>>12
Try using a lookup table for like the first 1000 primes, and calculate from there other primes that are bigger.