converting for loop into mathematical notation
-
29-09-2020 - |
Question
I am a bit confused with a problem that I am having.I am trying to do an amoritized analysis and I am able to represent the function that I want to use using code. I coded the function as follows:
sum = 1;
for(i = 1;i < n;i++){
sum = ceil(1.5 * sum);
}
The code is suppose to represent $\lceil....\lceil\lceil\lceil1.5 \times 1\rceil\times 1.5\rceil\times1.5\rceil...\times1.5\rceil$ and is suppose to keep going $n$ times. How would I represent this mathematically.
Thanks.
Edit: So I am trying to do an amoritized analysis on an array that grows by a factor of 1.5. So what I am trying to do is mathematically write what the code does.
What the code is suppose to represent is it is doing $\lceil...\lceil\lceil 1.5 \times 1\rceil \times 1.5\rceil...\times1.5\rceil$ The ... is suppose to represent the function multiplying by 1.5 $n$ times.
Also as an example if you post the following into desmos it will give you ceil(...ceil(ceil(1.5 * 1))...) 8 times.
\operatorname{ceil}\left(\operatorname{ceil}\left(\operatorname{ceil}\left(\operatorname{ceil}\left(1\cdot1.5\right)\cdot1.5\right)\cdot1.5\right)\cdot1.5\right)
I want to be able to have the behaviour of what is represented above mathematically so I can use it in an analysis. If anything is unclear again please comment.
Solution
Is the sequence $(a_i)_{i<n}$, where $a_0=1$ and $a_{i+1}=\lceil 1,5\cdot a_i\rceil$, what you need?