Number is divisible by function refactored