How to judge whether a number is prime or composite?

How to judge whether a number is prime or composite?

A prime number is a number that can only be divisible by 1 and itself
2,3,5,7,11,13,17,19,23,29,31
A composite number is a number other than prime and one
4,6,8,9,10,12,14,15,16,