[Math] Number of ways to write a given even number as a sum of two odd numbers

combinatorics

Assume we are given an even number, say $2m$.

Now take an even number $6 \le 2k \le 2m.$

Question, how many ways there are to write $2k$ as a sum of two odd integers $2v+1$ and $2h+1$, where $3 \le 2v+1 \le m+1$ and $3 \le 2h+1 \le m+1$. Obviously if $m+1$ is even, then you can only use numbers up to $m$.

Example, given $2m = 42$, $m=21$. The even numbers that can be written in the form I asked are $\{6,8,10,12,14,\dots,38,40,42\}$.

There is one way to write $6$ and also one way for $8$. Then two for $10$ and $12$, $3$ for the next two and so on, until we get five ways to write numbers $22,24$ and $26$ and then four ways for next two, and so on, until one way to write both $40$ and $42$. So the number of ways are given by list $\{1,1,2,2,3,3,4,4,5,5,5,4,4,3,3,2,2,1,1\}$.

If $m$ is even, there is three of the same in the middle, if $m$ is odd, there is unique number in the middle.

If $k$ is odd and smaller than $m/2$, there are $\frac{m-3}{2}+1$ ways to write $2k$.

The precise book keeping is to me a bit elusive, despite the simple structure of the result.

Best Answer

Just consider that one number is one of : $3,5,...,2\cdot k -3$ and the other one is forced by the choice of first one. Also there is no difference between $3,2k-3$ and $2k-3,3$ so totally is $\lceil{2k-3 - 3\over 4}\rceil + 1$. Ok I see the question is slightly different, the upper bound $m+1$ is given, then the formula can be changed to : $\lceil{min(2k-3,\lceil {m+1 \over 2} \rceil \cdot 2 - 1) - 3 \over 4}\rceil + 1$