Iterative decrement from A to B within n steps

38 Views Asked by At

I have an initial value A (with A > 1 e.g 100) and I want to reach the value 1 after n iterative decrements by a percentage x. More precisely, I want to find the value n that given:

A = 100
repeat for n times:
    A = A * x

produces A=1 at the end of the loop. How can I calculate this value?

1

There are 1 best solutions below

1
On BEST ANSWER

The first value of $n$ for which we'll have $A \leq 1$ will be given by $$ n = \left \lceil -\frac{\log(A)}{\log(x)} \right \rceil $$