Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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$

share|improve this answer
    
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. –  Padraic Cunningham Feb 18 at 17:55
    
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}$ –  Ross Millikan Feb 18 at 17:59
    
I will, thanks. –  Padraic Cunningham Feb 18 at 18:07
add comment

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$.

share|improve this answer
    
Thank you for the answer –  Padraic Cunningham Feb 18 at 18:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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