Left-Right Decimal to Binary
Here are several examples conversions from decimal to binary using the left-to-right method. To convert the decimal number n, do this:
1. Choose the largest power of two less than or equal to n. Call it p.
2. Generate the initial one of your result.
3. Subtract p from n.
4. Divide p by 2.
5. Repeat as indicated:
1. if n is less than p, append a 0 to your solution.
2. if n is greater or eqaul to p, append a 1 to your solution and subtract p from n.
3. If p is 1, stop. Otherwise, divide p by two and return to step a.
Just like this:
• 89210 = 11011111002:
 29 = 512 892 − 512 = 380 ⇒ 1 28 = 256 380 − 256 = 124 ⇒ 1 27 = 128 ⇒ 0 26 = 64 124 − 64 = 60 ⇒ 1 25 = 32 60 − 32 = 28 ⇒ 1 24 = 16 28 − 16 = 12 ⇒ 1 23 = 8 12 − 8 = 4 ⇒ 1 22 = 4 4 − 4 = 0 ⇒ 1 21 = 2 ⇒ 0 20 = 1 ⇒ 0
• 7110 = 10001112:
 26 = 64 71 − 64 = 7 ⇒ 1 25 = 32 ⇒ 0 24 = 16 ⇒ 0 23 = 8 ⇒ 0 22 = 4 7 − 4 = 3 ⇒ 1 21 = 2 3 − 2 = 1 ⇒ 1 20 = 1 1 − 1 = 0 ⇒ 1
• 3310 = 1000012:
 25 = 32 33 − 32 = 1 ⇒ 1 24 = 16 ⇒ 0 23 = 8 ⇒ 0 22 = 4 ⇒ 0 21 = 2 ⇒ 0 20 = 1 1 − 1 = 0 ⇒ 1
• 19610 = 110001002:
 27 = 128 196 − 128 = 68 ⇒ 1 26 = 64 68 − 64 = 4 ⇒ 1 25 = 32 ⇒ 0 24 = 16 ⇒ 0 23 = 8 ⇒ 0 22 = 4 4 − 4 = 0 ⇒ 1 21 = 2 ⇒ 0 20 = 1 ⇒ 0