17539 decimal to binary not getting the same result I'm trying to convert 17539 to binary. My math says its 110000010010001, but online calculators like this and this say it equals to 100010010000011. Who is making something wrong.
 A: \begin{align}
&&17539=2\cdot8769+1\\
&&8769=2\cdot4384+1\\
&&4384=2\cdot2192+0\\
&&2192=2\cdot1096+0\\
&&1096=2\cdot548+0\\
&&548=2\cdot274+0\\
&&274=2\cdot137+0\\
&&137=2\cdot68+1\\
&&68=2\cdot34+0\\
&&34=2\cdot17+0\\
&&17=2\cdot8+1\\
&&8=2\cdot4+0\\
&&4=2\cdot2+0\\
&&2=2\cdot1+0\\
&&1=2\cdot0+1
\end{align}
The binary representation is $\mathtt{100010010000011}$, because the first remainder you get represents the multiplier of $2^0$, just like $9$ in $17539$ is the remainder of the first division by $10$.
How do you remember? Think doing this with $2$:
\begin{align}
&&2=2\cdot1+0\\
&&1=2\cdot0+1
\end{align}
and it would be of course wrong to write $\mathtt{01}$ for the binary representation, wouldn't it?
A: Note that your value is the calculator value written in reverse order.  You are doing the calculation correctly, but not recognizing that the first remainder is the one's bit, not the high order bit.
A: Note that 
$$\begin{align}
17539 &= \color{red}1\cdot 2^{14}+ \color{red}0\cdot2^{13} + \color{red}0\cdot2^{12} +\color{red}0\cdot2^{11}+ \color{red}1\cdot 2^{10} \\ &+ \color{red}0\cdot2^{9} + \color{red}0\cdot2^{8} + \color{red}1\cdot 2^7 + \color{red}0\cdot2^{6} + \color{red}0\cdot2^{5} \\&+ \color{red}0\cdot2^{4} +\color{red}0\cdot2^{3} +\color{red}0\cdot2^{2} +\color{red}1\cdot 2^1 + \color{red}1\cdot 2^0.
\end{align}
$$
A: This python program converts from decimal to base 2.
 def convert(x):
        if x == 0 or x == 1:
            return str(x)
        return convert(x//2) + str(x%2)

    print(convert(17539))

Just change the number to what you want.  This produces a character string with
the desired binary expansion.  It works by "nibbling at the little end."  It mechanizes egreg's nice calculation.
