# X divided by Y, N times until a boundary is reached

not sure how to ask this but here is an example:

X = 31.0

Y = 2.0

Z = 5.0

i want to keep dividing X by Y and the result of that again by Y and so on until i reach Z i will stop.

assuming N is the number of times i had to do this Operation, can N be calculated in a single step without having to divide?

above example solved

31/2   = 15.5
15.5/2 = 7.75
7.75/2 = 3.878 stop as the result got to less than Z=5

in this case N is 3.

is it possible to write a function F(X,Y,Z)=N=?? which will give me N in one step of calculation?

• hint: it could involve logarithms – danimal Apr 16 '15 at 14:30

$$Y^{-n}\cdot X < Z \implies Y^{-n} <\frac{Z}{X}$$ What happens if you take the natural logarithm of both sides? Further, recall that $$\ln(A^B) = B\cdot\ln(A)$$