Summats Clear
Vassil from Lawnswood School, Leeds, Michael from Madras College St
Andrews and Koopa Koo from Boston College all solved this problem,
well done all of you.
Here is Vassil's solution:
Let $f(n)$ denote the sum of the first $n$ terms of the sequence
$$0, 1, 1, 2, 2, 3, 3,\ldots , p, p, p+1, p+1,\ldots.$$
First I tried with several numbers. Let $n=15$. Then $f(15)=2
\times (1+2+3+4+5+6+7)=7 \times 8$
where the sequence is: 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7,
7.
Let $n=14$. Then $f(14)=2 \times (1+2+3+4+5+6+7)-7=7 \times 7$
where the sequence is: $0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
7$.
Let $n=17$. Then $f(17)=2 \times (1+2+3+4+5+6+7+8)=8 \times
9$
where the sequence is: $0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7,
7, 8, 8$.
Let $n=16$. Then $f(16)=2 \times (1+2+3+4+5+6+7+8)-8=8 \times
8$
where the sequence is: $0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7,
7, 8$.
I noticed that the formula for $f(n)$ depends on whether $n$ is odd
or even.
${\bf Case}$ ${\bf I}$ - $n$ is odd, i.e. $n=2k+1$
Then $$\eqalign { f(n) = 2(1+2+...+k)\cr = 2k(k+1)/2 \cr = {\left(n
- 1\over 2\right)}{\left(n+1\over 2\right)}.}$$
${\bf Case}$ ${\bf II}$ - $n$ is even, i.e. $n=2k$
$$\eqalign { f(n) = 2(1+2+...+k) - k \cr = k^2 + k - k \cr = k^2
\cr = \left({n\over 2}\right)^2.}$$
Now we have to calculate $f(a+b)-f(a-b)$.
There are two cases. In the first case, when one of $a$ and $b$ is
even and the other is odd, then $(a+b)$ and $(a-b)$ are both odd.
Otherwise $(a+b)$ and $(a-b)$ are both even.
Case I $(a+b)$ and $(a-b)$ both odd. $$\eqalign{ f(a + b) - f(a -
b) = {(a + b)^2 - 1\over 4} - {(a - b)^2 - 1\over 4} \cr = ab.}$$
Case II $(a+b)$ and $(a-b)$ both even. $$\eqalign{ f(a + b) - f(a -
b) = {(a + b)^2\over 4} - {(a - b)^2\over 4} \cr = ab.}$$