Constant time checks if a small number is a prime or composite