While solving a probability problem, I came across a recurrent relation which I can't solve: $f(0)=0, f(1)=1$, and
$$f(n)=\frac{2}{n}\sum_{i=1}^{n-2}f(i) + 1 \ \text{for } n\ge 2$$
I simplified it:
$$nf(n) = (n-1)f(n-1)+2f(n-2)+1,$$ and now I struggle to find anything about this sequence. I suspect, that $\lim\limits_{n\rightarrow +\infty}\dfrac{f(n)}{n}=a$ exists. I tried to rearrange the formula and got $$f(n)-f(n-1) = -\dfrac{1}{n}(f(n-1)-f(n-2)) + \dfrac{1}{n}f(n-2) + \dfrac{1}{n},$$
$$\dfrac{f(n)-f(n-1)}{n-(n-1)} = -\dfrac{1}{n}\dfrac{f(n-1)-f(n-2)}{(n-1)-(n-2)} + \dfrac{1}{n}f(n-2) + \dfrac{1}{n},$$
so I assume, by solving $y'=-\dfrac{y'}{x} + \dfrac{y}{x} + \dfrac{1}{x}$, that $f(n) = c(n+1) - 1$.
Would appreciate any insight into this problem. Also, by calculating it on computer, I found that this limit $\approx0.43$.
Let me change the notation a bit. Let $(a_n)_{n\geq 0}$ be the sequence defined recursively by
$$ a_0 = 0, \qquad a_1 = 1, \qquad a_{n} = \frac{2}{n}\sum_{k=1}^{n-2} a_k + 1 \quad \text{for $n \geq 2$}. $$
Let $f(z) = \sum_{n=0}^{\infty} a_n z^n$ be its generating function. Then a bit of computation shows that the above recurrence relation translates to the differential equation of the form
$$ f(0) = 0, \qquad f'(0) = 1, \qquad (1-z)f'(z) = \frac{1}{1-z} + 2z f(z). $$
This equation can be easily solved using the method of integrating factors, yielding the unique solution
$$ f(z) = \frac{1 - e^{-2z}}{2(z - 1)^2}. $$
Expanding the numerator as the Taylor series about $z = 1$ and reorganizing the resulting expression, we can write
$$ f(z) = \frac{1 - e^{-2}}{2(z - 1)^2} + \frac{e^{-2}}{z - 1} + g(z) $$
for some entire function $g(z) = \sum_{n=0}^{\infty} b_n z^n$. (Although it is possible to give an explicit expression for $b_n$, what is important here is that $b_n \to 0$ as $n\to\infty$.) So by comparing the Taylor expansion of both sides,
$$ a_n = \frac{1 - e^{-2}}{2} (n+1) - e^{-2} + b_n. \tag{*} $$
Since $b_n \to 0$ as $n \to \infty$, it follows that
$$ \lim_{n\to\infty} \frac{a_n}{n} = \frac{1 - e^{-2}}{2} \approx 0.4323323584. $$