= Binary numeral system
{title2=$N=\sum_j d_j2^j,\quad d_j\in\{0,1\}$}
{wiki}
= Binary
{synonym}
= Base-2
{synonym}
The binary numeral system is <positional notation> with <radix> two. Each <binary digit> is zero or one, and its <place value> is a <power of two>. A one includes that weight in the sum; a zero skips it. The <binary representation> $11001101_2$ therefore selects $128,64,8,4,1$ and represents the <integer> $205$.
To obtain those <binary digits> from $205$, repeatedly use <Euclidean division> by two:
$$
\begin{aligned}
205&=2\cdot102+1,&102&=2\cdot51+0,\\
51&=2\cdot25+1,&25&=2\cdot12+1,\\
12&=2\cdot6+0,&6&=2\cdot3+0,\\
3&=2\cdot1+1,&1&=2\cdot0+1.
\end{aligned}
$$
The <remainders>, in the order produced, are $1,0,1,1,0,0,1,1$. \b[Read them in reverse order to get $11001101_2$.] The final zero is the <quotient> that stops the conversion, not an additional leading <binary digit>. Starting with zero itself needs the special single-digit representation $0_2$.
A useful independent check reads the <binary digits> from left to right. Start with $v=0$ and, for each <binary digit> $d$, replace $v$ by $2v+d$. For $11001101_2$, the intermediate values are $1,3,6,12,25,51,102,205$. This reconstructs the <integer> without reversing a list and explains why appending a zero on the right doubles the value.
Binary is well suited to computation because each <binary digit> has just two possibilities. A stored <bit> can encode either possibility; groups of <bits> encode larger <integers>. Practical integer arithmetic can use a <radix> that is itself a <power of two>, grouping several <binary digits> into each stored <numeral digit>.<A Computational Introduction to Number Theory and Algebra by Victor Shoup>[§3.3, p. 56: choice of a power-of-two base for stored integer digits]{ref} A displayed negative <integer>, such as $-11001101_2=-205_{10}$, uses a separate sign. A computer's particular signed storage convention is an additional encoding choice, so the displayed sign should not be confused with an extra binary place.
Back to article page