Prove that all even integers $n \neq 2^k$ are expressible as a sum of consecutive positive integers

The sum of the integers from $1$ to $n$ is $n(n+1)/2$. The sum of the integers from $k$ to $k+n$ is then $$\begin{align*} k+(k+1)+\cdots+(k+n) &= (n+1)k + 1+\cdots+n\\ & = (n+1)k + \frac{n(n+1)}{2} \\ &= \frac{(n+1)(2k+n)}{2}.\end{align*}$$

Therefore, $a$ can be expressed as the sum of consecutive integers if and only if $2a$ can be factored as $(n+1)(2k+n)$.

Suppose that $a$ is a power of $2$. Then $2a$ is a power of $2$, so $(n+1)(2k+n)$ must be a power of $2$. If we want to avoid negatives, and also avoid the trivial expression as a sum with one summand, we must have $n\geq 1$ and $k\gt 0$. But the parities of $n+1$ and of $2k+n$ are opposite, so this product cannot be a power of $2$ unless either $n+1=1$ (which requies $n=0$) or $2k+n=1$ (which requires $k=0$). Thus, no power of $2$ can be expressed as a sum of at least two consecutive positive integers. In particular, $8$, $16$, $32$, etc cannot be so expressed.

On the other hand, suppose that $a$ is even but not a power of $2$. If we can write $2a = pq$ with $p\gt 1$ and odd, $q$ even, and $q\geq p+1$, then setting $n=p-1$ and $k=(q-p+1)/2$ gives the desired decomposition. If this cannot be done, then every time we factor $2a$ as $pq$ with $p\gt 1$ odd, we have $q\lt p+1$. Then we can set $n=q-1$ and $k = (p+1-q)/2$.

Thus, the powers of $2$ are the only even numbers that are not expressible as the sum of at least two consecutive positive integers.

Added. The OP has now excluded powers of $2$, but has also required that the sum contains strictly more than two summands; i.e., $k\gt 0$ and $n\gt 1$. With the above decompositions, the only case in which we could have $n=1$ is if $2a=pq$ with $p$ odd, $p\gt 1$, and $q=2$. But this is impossible, since $a$ is assumed to be even, and this leads to $2a = 2p$ with $p$ odd.


The argument of @Arturo Magidin that powers of $2$ are not representable can be extended to a "formula" for the number of representations of any positive integer. For no good reason, we use slightly different notation.

Let $w$ be a positive integer. We look for integers $m\ge 0$, $n>m$ such that $$w=(1+2+\cdots +n)-(1+2+\cdots +m).$$ With a little manipulation, we can rewrite this as $$2w=(n-m)(n+m+1).$$ Temporarily, we allow $n-m=1$, even though this corresponds to expressing $w$ as the "sum" of one integer.

The numbers $n-m$ and $n+m+1$ are of opposite parity and have product $2w$. Note also that $n-m<n+m+1$.

Now take any two numbers $x$, $y$ of opposite parity whose product is $2w$. Set $n-m=x$ and $n+m+1=y$. We can solve for $n$ and $m$, and obtain a representation of $w$ as a sum of consecutive integers (again, possibly only one such integer.)

We obtain such $x$, $y$ of opposite parity as follows. Let $2w=2^k q$ where $q$ is odd. Express $q$ as a product of two positive integers $u$ and $v$, not necessarily distinct. Multiply one of $u$ or $v$ (say $v$) by $2^k$, and let $x$ be the smaller of $u$ and $2^k v$, and $y$ the larger.

So the number of representations of $w$ as a sum of consecutive positive integers is $d(q)$, the number of divisors of $q$. If we do not want to allow the trivial representation of $w$ as the short sum $w$, the number of representations is $d(q)-1$.

If $w$ is a power of $2$, then $q=1$, and therefore there are no representations. If $$w=2^{a_0}p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k},$$ where the $p_1,p_2,\dots,p_k$ are distinct odd primes, then the number of non-trivial representations is $$(a_1+1)(a_2+1)\cdots(a_k+1)-1.$$
In particular, if $w$ is not a power of $2$, there is at least one non-trivial representation.

Added: The OP has now excluded the possibility of $2$ consecutive integers. Since the original question is about even $w$, that makes no difference. For odd $w$, we just remove $1$ of the representations counted above.


8?${}{}{}{}{}{}{}{}{}{}{}{}{}$

[Note – this answer applied to an early version of the question, before it was edited.]