0
$\begingroup$

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?

$\endgroup$
  • 1
    $\begingroup$ hint: it could involve logarithms $\endgroup$ – danimal Apr 16 '15 at 14:30
2
$\begingroup$

Hint:
$$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)$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.