algorithms – Complexity function – Computer Science Stack Exchange

we start with i = 1, j = 1, i <= n, and j <= i and they increment i = i++ and j = j ∗ 2 respectively. The output prints ‘k’ times, whichreprents inner loop.
output: print s k times. Example when n=5, loop will print 11 times. How to find the complexity function of this algorithm for n=5?

So far, I figured out the pattern for n=5, p= 1+(2+2)+(3+3) which can be generalized by k2^(k-1) for n size 1+(2+2)+(3+3+3+3)+….. .
The answer is ((n+1)log(n+1)+1)-(2^(logn+1)) by the summation k
2^(k-1)- constant when k=1 to p . How do i go from summation to this answer? What value should be P if i do summation from k=1 to P:1+(2+2)+(3+3)?