Ways of writing $n=2a+b$ with $a$ and $b$ are non-negative integers For a non-negative number $n$, let $r_n$ be the number of ways of writing
$n = a + 2b$, where $a$ and $b$ are non-negative integers. 
For example,
$5 = 1  \cdot 5 + 2 \cdot  0 = 3 \cdot  1 + 1 \cdot  2 = 1 \cdot  1 + 2 \cdot  2$,
so $r_5 = 3$.
My question is I have found the rule that:
$r_0=r_1=1$, 
$r_2=r_3=2$, 
$r_4=r_5=3$, 
$r_6=r_7=4$,
......
$r_{n-1}=r_{n}=\frac{n+1}{2}$ where $n$ is odd.
But how can we prove this rule?

Note that $a$ is determined by $n$ and $b$ via $a=n-2b$, so $r_n$ is the number of valid choices for $b$. Since $a$ and $b$ must be nonnegative, we get $b\geq 0$ and $n-2b\geq 0$, so $\frac n2\geq b \geq 0$. If $n=2k$ or $2k+1$, then the only integer values $b$ can take are $0, 1, \ldots, k$ so there are $k+1$ choices. In particular, in the case $n=2k+1$, $$k+1=\frac{n-1+2}{2}=\frac{n+1}{2}$$ which is exactly the formula you found.
