Arranging marbles in a row so that every red marble is adjacent to a green marble. Suppose we have $m$ red marbles and $n$ green marbles, where marbles of the same color are identical.  
I would like to find out how many ways the marbles can be arranged in a row so that every red marble is adjacent to a green marble.  
If we let $f(m,n)$ denote the number of such arrangements, I believe we have the following special cases:
$f(1,n)=n+1, \;\;f(2,n)=\binom{n+2}{2}-2, \; f(3,n)=\binom{n+3}{3}-3n-1, \;f(m,n)=0 \text{ for }m>2n$
(This question was inspired by How many arrangements of MATHEMATICS are there in which each consonant is adjacent to a vowel?, where $f(7,4)=5$ is used.)
 A: Building on DanielV's idea: There are $n-1$ internal spaces between the green marbles, and two terminal spaces, one at either end. Each of the internal spaces can take $0$, $1$ or $2$ red marbles, and each of the terminal spaces can take $0$ or $1$. Thus, we can choose $k$ of $n-1$ spaces to contain $2$ red marbles, and then $m-2k$ of the remaining $n+1-k$ spaces (including the two terminal ones) to contain $1$ red marble, for a total of
$$
\sum_{k=0}^{n-1}\binom{n-1}k\binom{n+1-k}{m-2k}\;.
$$
A: Consider an acceptable arrangement of $m$ red and $n+1$ green marbles. I’ll use R and G to represent red and green marbles, respectively. If it ends with G but not with RRG, it can be obtained by adding G to the end of any acceptable arrangement of $m$ red and $n$ green marbles. If it ends with RRG or GGR, it can be obtained by adding RG or GR, respectively, to the end of an acceptable arrangement of $m-1$ red and $n$ green marbles ending in R or in G, respectively. And if it ends with RGR, it can be obtained by adding RGR to the end of any acceptable arrangement of $m-2$ red and $n$ green marbles. This accounts for all of the possibilities, so we have the recurrence
$$f(m,n+1)=f(m,n)+f(m-1,n)+f(m-2,n)$$
for $m\ge 0$ and $n\ge 1$, with initial values $f(0,1)=f(2,1)=1$, $f(1,1)=2$, and $f(m,n)=0$ for $m<0$ and $m>2n$. (It would make sense to set $f(0,0)=1$, but note that the recurrence then fails for $f(1,1)$.)
This is the triangular array OEIS A$025564$, shown below in rectangular format:
$$\begin{array}{c|cc}
n\backslash m&0&1&2&3&4&5&6&7&8&9&10\\ \hline
1&1&2&1\\
2&1&3&4&3&1\\
3&1&4&8&10&8&4&1\\
4&1&5&13&22&26&22&13&5&1\\
5&1&6&19&40&61&70&61&40&19&6&1
\end{array}$$
The entry doesn’t have a lot more information. It does give a generating function, and it has the observation that $f(m,n)$ is the number of weak compositions of $n$ with $m+1$ parts such that no two consecutive parts are $0$.
A: Each green marble has a space on either side that a red marble can be placed into.  So for $n$ green marbles, there are $2n$ locations that a red marble can be placed:
$$(~)(G)(~)~~(~)(G)(~)\dots(~)(G)(~)$$
Of those $2n$ locations, choosing $m$ of them and placing red marbles in them gives a unique valid sequence.  So there are $${2n \choose m}$$ possible sequences.
Edit: the sequences are actually not unique as joriki points out, apologies.
