recursive primality test based on finding smallest divisor from sicp