checker function wrapping primality