Condemned problem : Fliping a coin until he gets a sequence of heads. I have the following problem: There is a condemned that has the chance to be acquitted by tossing a coin. He is allowed to have how many tries he desired and the number of tosses in each try must be equal to the try number. He will be acquitted if in the first try he gets heads, or in the second try if he gets heads and heads (two toss), or in the third try if he gets heads, heads, heads (three toss) or in the k-th try if he gets k heads in a row. The question is: What is the total probability to the condemned be saved?
Naively, I proposed the solution bellow which are obviously wrong because, for instance, if the coin is unfair with probability of heads bigger than one half the probability bellow will be bigger than one. 
$$P = \sum_{k=1}^{\infty}  \left ( \frac{1}{2} \right )^k = 1$$
How should I model this problem?
EDITED:
Let p be the probability of heads. We will have for the first three tries:
$$P = p + (1-p) \dot\ p^2 + (1-p)\dot\ (1-p)\dot\ p^3 + (1-p)\dot\ p \dot\ (1-p)\dot\ p^3 + \dots$$
Tree of the events occurrence drawn until the third try.

 A: Let $P_k$ be the probability that the condemned escapes on their $k^{th}$ try.  $P_k =(1-\sum_{i=1}^{k-1}P_{i})\cdot(\frac{1}{2})^k\not = P_{k-1}\cdot\frac{1}{2}$, i.e. the probability he DIDN'T escape on a previous try times the probability he flips the $k$ heads.
Using a calculator to find the first few values leads to https://oeis.org/A005329 and the result can be verified using induction:
$$P_k = \frac{1}{2^\frac{k(k+1)}{2}}\prod_{i=2}^{k}{2^{i-1}-1}$$
$$P(\text{escape})=\sum_{k=1}^{\infty}{P_k}\approx0.7112119$$
A: Let $x\in[0,1]$ be the probability of heads in a single throw, and denote by $f_n(x)$ the probability that the prisoner is not yet free after $n$ trials. Then
$$f_0(x)=1,\qquad f_n(x)=(1-x^n)f_{n-1}(x)\quad(n\geq1)\ .$$
Since $f_n$ differs from $f_{n-1}$ only in the terms having an exponent $\geq n$ it follows that the $f_n$ converge in the sense of formal  power series to an $f$ which can be written as $$f(x):=\prod_{n=1}^\infty(1-x^n)\ .\tag{1}$$
The computation gives
$$\eqalign{f(x)&=x+x^2-x^5-x^7+x^{12}+x^{15}-x^{22}-x^{26}\cr &\qquad\qquad+x^{35}+x^{40}-x^{51}-x^{57}+x^{70}+x^{77}-x^{92}-x^{100}+\ldots\quad.\cr}$$
As expected in view of $(1)$ the exponents appearing here are related to the pentagonal numbers, resp., to partitions. If you take the reciprocal of $f$ you shall see the partition numbers as coefficients. In particular we see that the convergence is not only formal, but $f$ is analytic in the unit disk. Using the approximation $(2)$ one obtains $f(0.5)\approx 0.288788$, which corresponds to a probability $0.711212$ of becoming free in the limit.
