I have looked everywhere and cannot find an answer. If the answer already exists, please refer me to it.
I have a number $n$ and need to know the formula to find the numbers in the series $2^n$ that when summed equal $n$.
For example:
$25 = 16 + 8 + 1$ or $25 = 2^4 + 2^3 + 2^0$
Thank you.
You want to write the number as binary.
To do that, divide the number by 2 over and over again, and write down the remainders. for example,
$\begin{eqnarray} 25/2 = 12, remainder &1\\ 12/2 = 6, remainder & 0\\ 6/2 = 3, remainder &0\\ 3/2 = 1, remainder &1\\ 1/2 = 0, remainder &1\end{eqnarray}$
Now, each time the remainder is 1, you get a power of 2. Start with $2^0=1$ at the top, and count down. The remainder is 1 three times, so the powers of 2 are $2^0$, not $2^1$, not $2^2$, then $2^3$, and $2^4$.
So 25 = $2^0+2^3+2^4$.