
Patrick B. answered 03/16/19
Math and computer tutor/teacher
How to determine if N is prime....
step 1: Let x = N/2 + 1
step 2: for i=2,3,4,5,.... x
if N / i has no remainder
then N is not prime, as you have found a divisor
step 3: if none of i=2,3,4,5,...x evenly divides N, then it
has no divisors, so it is prime
You can RULE OUT Entire classes of numbers like evens or multiples of 3.
For example, if the N is odd, then you can skip over the even numbers in step 2,
because an odd cannot be divided by even.
another rule for divisibility by 3, is to add the digits.
EX. 123 --> total of the digits is 1+2+3 = 6 , which is a multiple of 3; so 123 divides by 3;
101010102 ---> total of the digits is 6, so again 101010102 divides by 3;
11111111 ---> total of the digits is 8, so it does NOT divide by 3.
Applying this test to N, determines if you must test multiples of 3, or can skip them.
For divisibility by 5, the number N must have zer0 or five as its last digit.