first version, forking from Check-primes