and you only need to test (up to the [itex]\sqrt{N}[/itex] ) the odd numbers that are not known multiples of other prime numbers (like multiples of 3, 5, 7, 11, 13, etc). if your programming language has a remainder operator (like the "%" operator in C and C++), you can use that to test a candidate factor to see if it divides evenly into N. but if you don't, you have to divide, use the floor() or int() operator to get the integer part of the quotient, subtract the integer part from the quotient and, if that result is zero, it divides evenly.
if all candidate factors fail to divide evenly into N, then N is prime. if anyone candidate factor divides evenly into N, it is not prime.