added Fermat primality test