improve primality test