find smallest divisor of an int in swift