Fix return type
Speed up the primality checker