Expected value with recursive probability First of all, I'm aware of an existing question with a similar title, but my problem is fundamentally different.
I'm trying to solve this: in the first try, there is a 5% probability of obtaining a success. In the second try, if the first one was a success, the probability resets to 5%, but if the first one was a failure, now there is 5% more probability (10%). This goes on an on for an arbitrary number of trials, what I'm trying to calculate is the expected number of trials to obtain a single success.
What I got is the probability of obtaining a success in try number $n$, which obviously depends on the probability of the previous try:
$$p(n) = p(n-1)\times 0.05 + (1-p(n-1))\times(p(n-1)+0.05),$$
with $p(1)=0.05$. Is it possible to calculate what I want?
In a more general way, what I'm asking is how to calculate the expected number of trials when the probability of success in a single trial depends on the probability of the previous trial, $p(n)=f(p(n-1))$.
 A: Let $p(n)$ be the probability of having a success within the first $n$ trials, and let $q(n)$ be the probability of having the FIRST success in trial $n$. Then it holds that $p(1)=q(1)=0.05$,
$$q(n)=0.05n[1-p(n-1)],$$
and
$$p(n)=p(n-1)+q(n).$$
Generate the sequences $p(n)$ and $q(n)$ for as long as they satisfy $0\leq p(n)\leq1$ and $0\leq q(n)\leq1$. It turns out that $p(21)=1$ and this is where you can stop. Then calculate
$$\sum_{n=1}^{21}q(n)n.$$
A: Not a complete answer. Let the probability of success on the first try be $1/m$, where $m$ is a positive integer. If the first try fails, the probability of success on the second try is $2/m$, and so on, as explained by the OP for $m = 20$. Success requires at most $m$ tries, since the probability of success on the $m$th try is $1$. The probability of success on the $r$th try and not before is $p(r)$ where
$$p(r) = {{m-1}\over{m}} \times {{m-2}\over{m}} \times \cdots \times {{m-r+1}\over{m}} \times {{r}\over{m}}.$$
The expected number of tries is
$$p(1) + 2p(2) + 3p(3) + \cdots + mp(m).$$
The values for $m = 1, \dots\ 6$ work out to
$$1,\quad3/2^1,\quad17/3^2,\quad142/4^3,\quad1569/5^4,\quad21576/6^5.$$
The numerators can be found in the OEIS at
https://oeis.org/search?q=1%2C3%2C17%2C142%2C1569&language=english&go=Search
Unfortunately the table doesn't go as far as $m = 20$ but the references may help.
