Assume two numbers a = 5, x = 1.
a = 5 * 1 = 5; x = 1 - 0.1 = 0.9
a = 5 * 0.9 = 4.5; x = 0.9 - 0.1 = 0.8
a = 4.5 * 0.8 = 3.6; x = 0.8 - 0.1 = 0.7
and so on…
Is there a way to find the Nth term elegantly? The only way I was able to derive was: (assuming N = 3 in this case):
a * (1-((N-0)*0.1)) * (1-((N-1)*0.1)) * (1-((N-2)*0.1))
…just a scenario in software development, wondering if I could implement a better solution.
First, write a recursive relation.
$$a_n = a_{n-1}(1-0.1n) $$ Write out the first few terms and get it in terms of $a_0$: $$a_1 = 0.9a_0$$ $$a_2 = 0.8a_1 = 0.8*0.9a_0 = \frac{8*9}{10^2}a_0$$ $$a_3 = 0.7a_2 =0.9* 0.8*0.7a_0 =\frac{7*8*9}{10^3}a_0$$ So that $$a_n = \frac{9!}{(9-n)!10^n}5$$ However, note that this only holds for $n<10$. If you would like it to work for values greater than $9$, you need to add in a separate recursion, where the difference is simply an absolute value sign and an alternating negative sign. $$a_n = \frac{(-1)^n*9!}{(|9-n|)!10^n}5$$
The $x$ relation is even easier. $$x_n = x_{n-1} - 0.1$$ Now repeat the procedure above: $$x_1 = x_0 - 0.1$$ $$x_2 = x_0 - 0.2$$ $$x_n = x_0 - 0.1n = 1-0.1n $$ Consequently, this holds for any value of $n$