Can we represents $k$ in partition of consecutive positive integer?

Let $$a,b$$ are non-negative integers.

Let define

$$S(a)=1+2+3+...+a=\sum_{i=0}^{a} i$$

and $$S(b)=1+2+3+...+b=\sum_{i=0}^{b} i$$

Question

Show that each $$k\in \mathbb{N}$$ and $$k \ne 2^t$$ $$\forall t\in \mathbb{N}$$ can be represent as

$$k = S(a)-S(b)$$ where $$a \ne b+1$$

My attempted

We can write $$k$$ as

$$k = S(a)-S(b)$$

$$= n+(n+1)+...+(n+u)= \sum_{i=0}^{u}n+i$$

$$=\frac{(u+1)(2n+u)}{2}$$ Where $$u\ge 1$$

For $$k>1$$ and $$k$$ is odd number then $$k$$ can be represent as

$$k= 2r+1 = r+(r+1)= S(r+1)-S(r-1)$$

Now proof for, if $$k= 2^t$$ then $$k\ne S(a)-S(b)$$

Proof

Let suppose $$k = n+(n+1)+...+(n+u)$$

$$=\frac{(u+1)(2n+u)}{2}= 2^t$$

So $$(u+1)(2n+u)= 2^{t+1}$$

Case1

if $$u$$ is odd then $$u+1=$$ even and $$2n+u =$$ odd so even×odd $$\ne 2^{t+1}$$ because $$2^{t+1}$$ content only even multiples except $$1$$.

Case2

if $$u$$ is even then $$u+1=$$ odd and $$2n+u =$$ even so odd×even $$\ne 2^{t+1}$$ similarly as case 1

So both cases show complete proof for $$k \ne 2^t$$

Example

$$6=1+2+3, 10=1+2+3+4,$$

$$12=3+4+5, 14=2+3+4+5,$$

$$18=5+6+7, 20=2+3+4+5+6$$

$$22=6+7+8, 24=7+8+9,$$

$$26=5+6+7+8,...$$

You can check advanced similar problem here

• it is ok.............. – Aqua Sep 22 at 7:38

You have shown above that it is impossible for any number of the form $$2^t$$ to be expressed as $$S(a)-S(b)$$. You have also shown that it is possible for all odd numbers. All you have to do is to extend the same idea for even values.
Case 1: The number is of the form $$2^{t-1}m$$ where $$m \geqslant 2^t+1$$ is odd
$$\frac{2^t \cdot (2^t+1)}{2}=2^{t-1}(2^t+1)=1+2+\cdots+2^t$$ $$2^{t-1}({2^t+1}+2k)=(1+k)+(2+k)+\cdots+(2^t+k)=S(2^t+k)-S(k)$$ for all non-negative integers $$k$$. We set $$k=m-2^t-1$$
Case 2: The number is of the form $$2^{t-1}m$$ where $$1 is odd $$\frac{m(m+1)}{2}=1+2+\cdots+m$$ $$m(\frac{m+1}{2}+k)=(1+k)+(2+k)+\cdots+(m+k)=S(m+k)-S(k)$$ for all non-negative integers $$k$$. We set $$k=2^t-1-m$$
The reason why $$m \neq 1$$ is because we must have $$a \neq b+1$$ but at $$m=1$$, we have $$a=k+1$$ and $$b=k$$. Thus, using the two cases, any even number which is not a power of $$2$$ can be expressed as required.