# Decimal to binary question [closed]

This is an easy question, but I can't explain it lol, how would you guys explain it?

There is a procedure for converting a decimal number to binary in the following way: repeatedly divide the number by 2, writing the quotient and remainder at each step. Stop when 0 is obtained as a quotient. The sequence of remainders, written backwards (from the way they were obtained) is the binary representation. Here is an example, ﬁnding the binary representation of 49:

|49 24 1 |

|24 12 0 |

|12 6 0 |

|6 3 0 |

|3 1 1 |

|1 0 1 |

So 49 = 110001 (base 2) - Explain why this method works.

-

Do you want to know why it works or the details of how it works? – Thomas Jun 1 '12 at 4:04
either way is good :) – hihello4 Jun 1 '12 at 4:16
Did my answer help? – Thomas Jun 1 '12 at 4:49
Sorry, I can't find how this relates to cryptography, the topic of this site. – Paŭlo Ebermann♦ Jun 1 '12 at 7:26

## closed as off topic by fgrieu, Paŭlo Ebermann♦Jun 1 '12 at 7:25

Questions on Cryptography Stack Exchange are expected to relate to cryptography within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

## 1 Answer

In base 10 we write for example $133$ when we mean $$133 = 1 * 10^2 + 3*10^1 + 3*10^0.$$ If we want to write $49$ in base $2$ then note first that: $$49 = 1*2^5 + 1*2^4 + 0*2^3 + 0*2^2 + 0*2^1 + 1*2^0.$$ Because of this $49$ is $110001$.

Noe obviously, you "don't know this", but I wanted to write it down so that you can see what happens as you divide by two.

So you want to find the digits in base you, you could start by dividing $49$ by $2$. You get a remainder of $1$ because $49$ is odd. Hence you know that the coefficient in from of $2^0$ is one. You subtract that reminder and divide by $2$. Dividing by $2$ decreases all the exponents by one, so $$24 = 1*2^4 + 1*2^3 + 0*2^2 + 0*2^1 + 0*2^0.$$ Now you just continue like this dividing by $2$ to find the coefficient infront of $2^0$ (which then is the coefficient in front of $2^1$ in $49$).

Maybe this is all too many words...

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 16, "mathjax_display_tex": 3, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9515625834465027, "perplexity_flag": "middle"}