# Does this mathematical technique have a formal name? And why does it work?

When I split a number in the powers of 2. I am able to make any combination of any number that is less than it by taking each number of the series only once.

For example:

$7=1+2+4$

I can construct any number less than or equal to seven using the $3$ numbers $1,2,4$.

Or take $10$ for instance:

$10 = 1 + 2 + 4 + 3$

I can construct any number that is less than or equal to $10$ using the 4 numbers.

How this decomposition is done is via breaking the number in powers of 2 until you can't break it anymore. More examples:

5 -> (1, 2, 2)
10 -> (1, 2, 4, 3)
15 -> (1, 2, 4, 8)
1000 -> (1, 2, 4, 8, 16, 32, 64, 128, 256, 489)


Does this method of decomposition have a name? And how does it allow us to make any number that is less than or equal to it?

• How is $3$ a power of $2$? Or $489$? You could write $10=2+8$ and $1000=512+256+128+64+32+8$, these are the binary representations of the numbers. – Servaes Aug 17 '18 at 12:16
• @ng.newbie No, I don't get it. Why would you use $10=1+2+\color{red}3\color{black}+4$ instead of $10=2+8$ – Don Thousand Aug 17 '18 at 12:24
• This is hard to follow. Why is $5=(1,2,2)$ instead of $(1,4)$? The rules seem arbitrary. – lulu Aug 17 '18 at 12:27
• I think you guys are missing that it’s increasing powers of $2$. So you go $1+2+4+8+...$ until the next power of 2 is too large. – Stella Biderman Aug 17 '18 at 12:29
• Do we call this "binary"? – Joshua Aug 17 '18 at 18:38

To see that you can write every natural number $≤n$ as a partial sum of the decomposition of $n$:

Let $2^k$ be the greatest power of $2$ not exceeding $n$. Then your decomposition is $$n=1+2+\cdots +2^{k-1}+ (n-2^k+1)$$

That is, the "remainder" is $r_n=n-2^k+1$.

We note that $1+2+\cdots +2^{k-1}=2^k-1$ so you can get every natural number $<2^k$ as a partial sum of those terms (using the binary expansion).

But then, adding $r_n$ you get can every natural number from $r_n$ to $r_n+2^k-1=n$ and we are done.

• You seem to have an off-by-one error. $1+2=4-1$ – Stella Biderman Aug 17 '18 at 12:41
• @StellaBiderman Yes, thanks. I specialize in those. Here the blunder was that $1+2+\cdots +2^{k-1}=2^k-1$, not $2^k$. – lulu Aug 17 '18 at 12:57
• @lulu No, I don't quite understand it yet. Why can't I form all numbers from an expansion of the powers of $3$ or $4$ or $5$ or any other number? The power of $1$ and $2$ are the only ones that have this property. That was my question. Is this the correct place or clarify it or should I post a different thread? – ng.newbie Aug 20 '18 at 8:01
• @lulu When you say "so you can get every natural number $<2^k$ as a partial sum of those terms (using the binary expansion)" I dont understand what you mean by this. What exactly is binary expansion? – ng.newbie Aug 20 '18 at 8:02
• "Binary Expansion", just refers to writing integers in base $2$. See, e.g., this for a standard write up. You only need the digits $0$ and $1$, so any integer can be written as a sum of distinct terms in $\{1,2,2^2,2^3,\cdots\}$. You can write every integer in base $3$ or $5$ but you need digits other than $0$ and $1$. That means you can't write every integer as a sum of distinct terms in $\{1,3,3^2,\cdots\}$. – lulu Aug 20 '18 at 9:44

First of all, $1+2+4+\cdots2^n = 2^{n+1}-1$. So, for example

$$1000 = 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + \color{red}{489}$$ $$1000 = 2^0 + 2^1 + 2^2 + 2^3 + 2^4 + 2^5 + 2^6 + 2^7 + 2^8 + \color{red}{489}$$
is the same thing as saying $$1000 = (512-1)+\color{red}{489}$$ $$1000 = (2^9-1)+\color{red}{489}$$

If you pick a number, say $2345$, you notice that $$2^{11}-1 = 2047 < 2345 < 2^{12}-1=4095$$

and

$$2345-2047 = 298$$

So

$$2345 = 1 + 2 + 4 + 8 + 16 + 32 + \cdots + 2048 + \color{red}{298}$$

I have never seen anything mathematical that referred to this pattern. So I don't know if it has a name or not, nor can I know if anyone else found it interesting.

• The last power of two in the last equality should be $1024$, not $2048$. – Adayah Aug 17 '18 at 14:58

There is a process of breaking a number into a sum of powers of $2$, called the binary expansion. To do this, you first see what is the largest power of $2$ that is smaller than your number. Then you take it out, and iterate.

This is different from your own process, because what you do is take powers of $2$ from the smallest ($1$) and keep going till the next larger doesn't fit. However, the usual binary expansion is quite useful, as shown for instance by the example below.

Using it to compute powers efficiently in time is called the fast exponentiation algorithm, or exponentiation by squaring. E.g. to compute $x^7$ all you need is $x$, squared into $x^2$ squared into $x^4$ and multiply all three $$x^7=x\cdot x^2\cdot x^4$$

• But the issue is that his expansion is not exactly binary, e.g. $10=1+2+\color{red}3\color{black}+4$ – Don Thousand Aug 17 '18 at 12:25
• -1 The comments make clear that this is not what the asker is after. – Servaes Aug 17 '18 at 12:25
• @Servaes Possibly. I edited to explain the difference between the OP and this answer, because it is quite straightforward to explain. – Arnaud Mortier Aug 17 '18 at 12:31
• @ArnaudMortier Wonder why this got a downvote – ng.newbie Aug 17 '18 at 12:33
• @ng.newbie Thanks. Servaes explained that I was not really answering the question. I guess it's debatable. – Arnaud Mortier Aug 17 '18 at 12:39

As far as I know this method does not have a name. Perhaps if you could describe its purpose, or give some context, that would help to find a name.

And it is obvious from the definition that every number can be represented this way; given a number $n$, you keep subtracting higher powers of $2$ the remainder is less than the next power of $2$. The remainder is then the last number in the representation.

• It really comes down to the flexibility of the remainder +1. – Don Thousand Aug 17 '18 at 12:30
• @Servaes Got this method when I was reading about the bounded knapsack problem being turned into a 0/1 Knapsack problem. It was from this paper. – ng.newbie Aug 17 '18 at 12:33
• Since it is clearly not obvious to the OP why this occurs, I think more of an explanation is required. – Stella Biderman Aug 17 '18 at 12:33
• @StellaBiderman Yes I need more explanation. More than I want to know how I can combine it to make any number less than or equal to that number I am breaking. – ng.newbie Aug 17 '18 at 12:34
• @StellaBiderman Feel free to give one; I can't be bothered to explain why division with remainder is well-defined at the moment. – Servaes Aug 17 '18 at 12:34

Countrary to most of your feedback, this is not at all binary representation, because you split from the small end and not from the big end.

What you are doing is splitting from the small end, so you will end up with a number $2^k-1 + b$, where $b$ is some remainder. I don't know if this has any name, but it sure is not a binary representation of the number.