TITLE: Solve $a_n=1+\frac{1}{n}\sum_{i=0}^{n-1}a_i$
QUESTION [5 upvotes]: As first sight this appears almost trivial. But I am having serious trouble finding a solution.
Consider the relation
$$a_n=1+\frac{1}{n}\sum_{i=0}^{n-1}a_i$$
for $n\in\mathbb{N}$, with $a_0=0$. Can you find an expression for $a_n$ as a function of $n$?

The sequence goes like $0,1,3/2,11/6,25/12,137/60,...$
I have tried to find solutions of the form $a_n=pn^2+qn+r$ without success. Does anyone have any ideas?

REPLY [3 votes]: we have
$$(n+1)a_{n+1}-na_n=a_n+1$$
or
$$a_{n+1}=a_n+\frac {1}{n+1}$$
thus
for $n\ge 1$,
$$a_n=a_0+\sum_{k=1}^n\frac {1}{k} $$

REPLY [2 votes]: Let us attempt to prove by induction that $a_n=H_n=\sum_{k=1}^n 1/k$ is the $n$th harmonic number. $n=0$ clearly works. Suppose now that $a_i=H_i$ for $i<n$. We would then have
$$ \sum_{i=0}^{n-1} a_i = \sum_{i=1}^{n-1} \sum_{k=1}^i \frac{1}{k} = \sum_{k=1}^{n-1} \frac{1}{k} \sum_{i=k}^{n-1} 1 = \sum_{k=1}^{n-1} \frac{n-k}{k} = \sum_{k=1}^{n-1} \frac{n-k}{k} = nH_{n-1} - (n-1), $$
so
$$ a_{n} = 1 + \frac{1}{n} \sum_{i=0}^{n-1} a_i = 1 + H_{n-1} - 1 + \frac{1}{n} = H_n, $$
as required.