Need help understanding how to find big theta of a snippet of code Say I have a snippet of code:

k = 5
i, j = 0

for i -&gt; n
    if i == k
        for j -&gt; k
            /* do something */ 
        end for
    k = k * 4/3
    end if
    /* do something */
end for


I can tell that the algorithm is worse than n but can't be worse than n^2. In fact it seems like it would be less than n log (n). Though I admit these are just guesses I'm making. Is there any methodology to figuring out what the big theta is for such algorithms?
In order to estimate the running time of the code it is enough to count the number of times the two "do-somethings" are executed. Call them do-something 1 and do-something 2 (in their order of appearance). Do-something 2 is executed about $n$ times. As for do-something 1:


If $n &lt; 5$, no times.
If $5 \leq n &lt; (4/3)5$, $5$ times.
If $(4/3)5 \leq n &lt; (4/3)^25$, $(4/3)5$ times.
Generally, if $(4/3)^k5 \leq n &lt; (4/3)^{k+1}5$, $(4/3)^k5$ times.


Be creative and estimate the number of times that do-something 1 is executed in terms of $n$. Conclude the running time of the code snippet.