Solution (source code)

= Solution

For a nonnegative continuous event time, the <survivor function> is $F(t)=\mathbb P(T>t)$; here the printed $F$ denotes survival, not the usual <cumulative distribution function>. A lower <median> is
$$
\boxed{m=\inf\{t\geq0:F(t)\leq1/2\}.}
$$
For a continuous strictly decreasing <survivor function> this is the unique solution of $F(m)=1/2$. If the curve has a flat stretch at $1/2$, the distribution has a nonunique median and the infimum specifies the lower endpoint.

The <tail integral formula for moments> follows from $T=\int_0^\infty\mathbf1\{T>t\}\,dt$ and <Tonelli theorem>. Therefore, when survival vanishes beyond $t^*$,
$$
\boxed{\mathbb ET=\int_0^{t^*}F(t)\,dt.}
$$
If $F(t)>0$ at every finite time, the mean is finite precisely when $\int_0^\infty F(t)\,dt<\infty$. For a concrete sufficient condition, require $F(t)\leq Ct^{-1-\varepsilon}$ for all $t\geq M>0$, with $C<\infty$ and $\varepsilon>0$. The integral over $[0,M]$ is at most $M$, and the tail integral is at most $CM^{-\varepsilon}/\varepsilon$. An exponential tail bound also suffices. Merely having $F(t)\to0$, or even $tF(t)\to0$, does not suffice: a properly completed decreasing tail proportional to $1/(t\log t)$ for $t\geq e$ has infinite mean.