Every natural number from $1$ to $n$ ($n >0)$ was multiplied by a power of two (the exponent can be different). After that all the numbers were summed. At what $n$ will the sum also be a power of $2$? Something tells me that it can be at any $n$. I think we have to start with summarizing numbers from $1$ to $n$ by using the formula $$\frac{n(n+1)}{2}.$$
Every number from $1$ to $n$ gets multiplied by $2^n$
-
1So $$\sum_{k=1}^n2^{a_k}k$$ is a power of $2$? – 2017-01-09
-
0Your question is not clear ... Are you asking for what $n$ it is possible that the sum is a power of two ... assuming we can for each number from 1 to $n$ we can choose the exponent $k$ of $2^k$ by which the number is multiplied? – 2017-01-09
-
1When you say "Something tells me that it can be at any n", are you saying that this is your conjecture, or that some source other then you tells you this? – 2017-01-09
-
0What does "the exponent can be different" mean? Is the formula given by @HagenvonEitzen more accurate, where each number $k$ from $1$ to $n$ has a "free" choice of exponent? – 2017-01-09
-
0So, for example: $1*2^1=2^1$, $1*2^1+2*2^0=2^2$, $1*2^0+2*2^1+3*2^0=2^3$ are all compatible with what you are asking ... but now you want to see if we can do this for any $n$ (and even though we have a choice in exponent, maybe we can even show that the sum can always be set to $2^n$ as a stronger theorem?) – 2017-01-09
-
0$2^4 = 1*2^0+2*2^1+3*2^0+4*2^1$, $2^5=1*2^0+2*2^1+3*2^0+4*2^0+5*2^2$, $2^6 = 1*2^1+2*2^0+3*2^2+4*2^0+5*2^2+6*2^2$ ... still works ... but I'm not seeing any pattern yet ... – 2017-01-09
3 Answers
Are you talking about the following series : $$1.2^1,2.2^2,...n.2^n$$
It is an Arithmetico Geometric series. Summation of its terms can be found out as follows:
Let $$S = 1.2^1+2.2^2+3.2^3...+n.2^n $$ Now multiplying both sides by the common ratio $2$, we get
$$2.S = 1.2^2+2.2^3+3.2^4...+(n-1).2^n+n.2^{n+1}$$
Subtracting $2^{nd}$ equation from $1^{st}$ equation, we get
$$-S = 1.2^1+1.2^2+1.2^3+...+1.2^n-n.2^{n+1}$$
Now leaving the last term of our series aside, we observe a G.P. with common ratio $2$ and first term $2$, upon summing it we get,
$$-S = 2(2^n-1)-n.2^{n+1}$$ $$-S = 2^{n+1}-n.2^{n+1}-2$$ $$S=(n-1)2^{n+1}+2$$
$$S = 2(1+(n-1)2^n)$$ Now, we can see that the term $(n-1)2^n$ is even, so adding $1$ to it which is the case will make it odd. Now, for being power of $2$ all the factors of the numbers must be $2$ which is even. Hence, $S$ can't be power of $2$ except for $n = 1$ in which case $S = 2$.
So, the only solution is $n = 1$.
It is always possible. Let $T_n=\frac 12n(n+1)$ be the sum of the numbers from $1$ to $n$. For $n \gt 1$ we can always find $k$ such that $2^{k-1} \lt T_n \lt 2^k$. We just have to find a set of numbers between $1$ and $n$ that sum to $2^k-T_n$ and multiply them all by $2$, multiplying all the rest by $1$. We can do this by taking $n, n-1, n-2 \ldots$ until the sum gets too large, deleting the last one, and picking the smaller number we need to come out even. We can then achieve $2^m$ for $m \gt k$ by multiplying all the multipliers by $2^{m-k}$
-
0Yes! Very nice!! – 2017-01-09
-
0This proves a slightly stronger result than requested, in fact: we only have to use the powers $2^0$ and $2^1$ as multipliers. – 2017-01-09
Assume $n$ is an "$m$-bit number", i.e., $2^{m-1}\le n<2^{m}$. Let $S$ be the sum of all numbers from $1$ to $n$ that are neither powers of $2$ nor $3$ times powers of $2$. Then $$ S\le \frac{n(n+1)}{2}-2^{m}+1\le(2^m-1)(2^{m-1}-1)<2^{2m-1},$$ So $S$ is at most a $2m-1$-bit number. By picking $2^m$ as coefficient for each non-power-of-2 summand, these therefore contribute $2^mS$. But we still have $m$ summands of the form $2^k$ and at least $m-1$ sumands of the form $3\cdot 2^k$. We will use these wisely:
Suppose our sum so far ends in $r$ binary zeroes, i.e., it is $2^r s$ where $s$ is odd (and $r\ge m$).
If $s\equiv 1\pmod 4$ and we still have a number $3\cdot2^k$ available, we can pick a suitable power of two as coefficient to arrive at $$ 2^rs+3\cdot 2^{r-k}\cdot 3\cdot 2^k=2^r(s+3)=2^{r+2}\cdot\frac{s+3}4,$$ a number with at least two more zeroes at the end and not more bits in total (unless we had $s=1$ and thus now have $2^{r+2}$, a power of two, as sum).
On the other hand, if $s\equiv 3\pmod 4$ and we still have a number $2^k$ available, w can achieve $$2^rs+2^{r-k}\cdot 2^k=2^{r+2}\cdot\frac{s+1}4$$ as next sum, again a number with at least two more zeroes at the end an not more bits in total (unless we now have a power of two).
Thus we can at least $m-1$ times (namely, as long as we can guarantee to still have a $2^k$ or $3\cdot 2^k$ available, whatever is needed) increase the number of trailing $0$ digits by two without increasing the bit length of the sum (unless we achieve a power of $2$ as sum). As $S$ has at most $2m-1$ bits, this means that we can zero $2(m-1)$ of these, i.e., we can arrive at a power of $2$, possibly without even using all our summands. The remaining sumamnds, if any, can be added one by one without destroying the power-of-two-ness of the sum. So finally we arrive at a sum that is a power of $2$.
-
0Thanks! Now I can go back to actual work! :) – 2017-01-09