IntegerExponent

IntegerExponent[nb]
gives the highest exponent of b that divides n.