Smallest prime factor
Your task
Return the smallest prime factor of a positive integer n (with n up to about 10^12). If n is prime, the smallest prime factor is n itself. Return -1 for n < 2. Handle the factor 2 first, then trial-divide by odd numbers up to sqrt(n); the first odd divisor found is the smallest prime factor.
Examples
smallest_prime_factor(n: int) -> intExample 1
Input
smallest_prime_factor(21)Output
3