how to find smallest divisor in python