Infection in a village Consider the following problem:

Suppose a lonely wanderer infected with a virus came into an isolated village with $M$ villagers and stayed there. Every week each of the infected villagers coughs onto $n$ random other villagers (each of them chosen uniformly and independently among everyone) and then develops antibodies becoming immune to it. All villagers who are coughed upon become infected if they are not immune. Nobody left or entered the village after the arrival of the lonely wanderer. Consider time to be discrete and measured in weeks. We say, that the virus survives as long as someone is infected with it. For what $n$ is the expected time of its survival the longest?

The extremum clearly is not achieved in the border cases here.
Indeed, if $n = 0$ the lonely wanderer becomes immune before being able to infect anyone else, thus the virus will survive only for $1$ week.
If $n \to \infty$ the probability that the lonely wanderer infects everyone in the first week tends to $1$. Thus the expected time of the survival of the virus tends to $2$ in this case.
So, we must look for optimal $n$ somewhere in between. However, I have no idea how to find it (or even its asymptotic for large $M$)…
At the first glance the problem looked to be somewhat similar to two well studied problems: branching processes (villagers infected by a given infected villager - their descendants in terms of branching processes) and coupon collector problem (uninfected villagers as coupons to be collected). However, it is different from both of them (the number of ‘descendants’ changes each turn here, which makes it different from a Galton-Watson branching process, and the number of ‘coupons collected per turn’ depends on the number of ‘coupons collected on the previous turn’, which makes it different from a classical coupon collector) and methods, similar to the ones used to solve them, are unlikely to work here.

Putting that at week $w$ we have the following numbers of infected, susceptible (infectable), and immunized
$$
I(w) = {\rm infected}\quad S(w) = {\rm infectable}\quad H(w) = {\rm immunized}
$$
then, allowing for the numbers to be rationals, we shall have
$$
\left\{ \matrix{
  I(0) = 1\quad S(0) = m\quad H(0) = 0 \hfill \cr 
  I(w) + S(w) + H(w) = m + 1 \hfill \cr 
  H(w) = I(w - 1) \hfill \cr 
  I(w+1) = {n \over {m + 1}}S(w) \hfill \cr}  \right.
$$
Solving for $I$ (excluding the banal case $n=0$)
$$
I(w) + {{m + 1} \over n}I(w + 1) + I(w - 1) = m + 1\quad \left| \matrix{
  \;I(0) = 1 \hfill \cr 
  \;I(1) = n{m \over {m + 1}} \hfill \cr}  \right.
$$
and recasting it by including the initial conditions,  so that the recursion is valid for any $0 \le w$, under the acception that $w <0 \; \Rightarrow  \; I(w)=0 $
$$
I(w) + {n \over {m + 1}}I(w - 1) + {n \over {m + 1}}I(w - 2)
 + \left[ {0 = w} \right]\left( {n - 1} \right) = n\quad \left| {\;0 \le w} \right.
$$
We can solve the above via ordinary generating function
$$
F(z) = \sum\limits_{0\, \le \,w} {I(w)\,z^{\,w} } 
$$
readily obtaining
$$
\eqalign{
  & F(z) = {{{n \over {1 - z}} - \left( {n - 1} \right)} \over {1 + {n \over {m + 1}}\left( {z + z^{\,2} } \right)}}
 = {{m + 1} \over n}{{1 + \left( {n - 1} \right)z}
 \over {\left( {1 - z} \right)\left( {z^{\,2}  + z + {{m + 1} \over n}} \right)}} =   \cr 
  &  = {{m + 1} \over n}{{1 + \left( {n - 1} \right)z}
 \over {\left( {1 - z} \right)\left( {z + {1 \over 2} + {{\sqrt {1 - 4\left( {m + 1} \right)/n} } \over 2}} \right)
\left( {z + {1 \over 2} - {{\sqrt {1 - 4\left( {m + 1} \right)/n} } \over 2}} \right)}} =   \cr 
  &  = {A \over {\left( {1 - z} \right)}} + {B \over {\left( {z + {1 \over 2}
 + {{\sqrt {1 - 4\left( {m + 1} \right)/n} } \over 2}} \right)}}
 + {C \over {\left( {z + {1 \over 2} - {{\sqrt {1 - 4\left( {m + 1} \right)/n} } \over 2}} \right)}} \cr} 
$$
where, however, $A,B,C$ are rather complicated expressions
of $m,n$.
Normally it would be $n \le m$, so that the square roots will turn into immaginary values.
