You can use prime factorization to determine if an integer is a prime
First check if n is either 2,3,5,7 then it is a prime.
then set f = 2
test if n % f = 0. If then it's not a prime
if it's not 0 then set f = 3 and repeat. Do this for f = 2, 3, 5 and 7
when f is > 7 then check if n < 1. If then it's not a prime. Otherwise it's a prime.
Take 20 for instance
f = 2
n = 20
n % f = 0, => not a prime
----
f = 2
n = 19
n % f != 0
f = 3
n % f != 0
f = 5
n % f != 0
f = 7
n % f != 0
n = 19, is a prime since 19 > 1
Hope it helps
