If I have a list of numbers starting with four numbers, the list doubles in size after each iteration, how would I calculate how take to have a list of exactly n elements long? Thanks
2 Answers
$\begingroup$
$\endgroup$
3
After $n$ iterations, you have $4\cdot 2^n$ elements. If you want to have $N$ elements, $N=4\cdot 2^n, \log_2 N=2+n$
-
$\begingroup$ could you write a simple example, it has been a long time since I have used any of this, just want to make sure I understand it. $\endgroup$ Commented Feb 18, 2014 at 17:55
-
$\begingroup$ Why don't you try calculating it for a few small values of $n$? To solve for $n$ your calculator probably gives $\log$ to base $10$ and base $e$. One of the laws of logarithms is $\log_2 N=\frac {\log_a N}{\log_a 2}$ $\endgroup$ Commented Feb 18, 2014 at 17:59
-
$\begingroup$
$\endgroup$
0
A sequence is defined by $a_0 = 4$ and $a_n = 2 a_{n-1}$ is given by $$ a_n = 2^{n+2}, \quad n \geq 0. $$ Solve $N = 2^{n+2}$ to get $n = \log_2 N - 2$.