I am looking for some sequence of random variables $(X_n)$ such that
$$ \lim_{n \rightarrow \infty} E(X_n^2) = 0 $$
but such that the following almost sure convergence does NOT hold:
$$ \frac{S_n - E(S_n)}{n} \rightarrow 0$$
where the $S_n$ are the partial sums of the $X_n$.
Note: for any such sequence the convergence in probability will always hold; if the random variables are not correlated, so will the convergence almost surely. In particular, any counterexample must consist of correlated random variables.
Many thanks for your help.
Here is an algorithm which gives you such a sequence. Let us work on the probabilised space $[0,1)$ with the Lebesgue measure.
For all $0 \leq k < n$, let $I_{k,n} := [k/n, (k+1)/n)$. Fix $\varepsilon \in (0,1)$
Start from $n = 1$, $k=0$, time $N=0$.
If $S_N < \varepsilon N$ on $I_{k,n}$, take $X_N = 1_{I_{k,n}}$.
Else :
if $k < n-1$ : increment $k$ by $1$.
if $k = n-1$ : increment $n$ by $1$, put $k=0$.
Rince and repeat, incrementing $N$ by $1$.
Now, for all $k,n$, we only need a finite time before $S_N \geq \varepsilon N$ on $I_{k,n}$ (the times at which these conditions are satisfied successively grow exponentially, though). Hence we will eventually increment $k$, and then $n$. Since any point in $[0,1)$ is in infinitely many $I_{k,n}$, that means that almost surely, $S_N \geq \varepsilon N$ for infinitely many $N$.
On the other hand, $\mathbb{E} (X_N) = \mathbb{E} (X_N^2)$ will converge to $0$. Hence, $\mathbb{E} (S_N)$ grows sub-linearly, so that almost surely, $S_N - \mathbb{E} (S_N) \geq \varepsilon N/2$ for infinitely many $N$s.