This is a problem from Loren Larson's "Problem solving through problems", 2.5.13, page 78.
Let $S_{n}=${$1,2,...,n$}. A derangement of $S_{n}$ is a permutation with no fixed points. Let $g_{n}$ be the number of derangements, and $f_{n}$ the number of permutations of $S_{n}$ with exactly one fixed point. Show that $|f_{n}-g_{n}|=1$
I proved that $g_{n}=(n-1)(g_{n-1}+g_{n-2})$, and by analyzing the number of permutations for $S_{3}$ and $S_{4}$ I've conjectured that $g_{2n}=f_{2n}+1$, and $g_{2n+1}=f_{2n+1}-1$, although I don't know how to prove it. I also found that $f_{n+1}=(n+1)g_{n}$.