Converting binary numbers to Octal numbers in 1-2-3:

1)
Write down your binary number:
100100101011

2)
Divide your binary number into groups of 3 bits

(if you have an amount of bits that is not evenly divisable by 3 you add 0 bits onto the left side.)
100 100 101 011

3
convert each group into a octal digit using this formula:
f(a,b,c) = a*2^2 + b*2^1 +c

1: 1*2^2 + 0*2^1 +0 = 4
2: 1*2^2 + 0*2^1 +0 = 4
3: 1*2^2 + 0*2^1 +1 = 5
4: 0*2^2 + 1*2^1 +1 = 3


100100101011(2) = 4453(8)

If you want to convert decimal numbers to octal numbers, you problaby want to convert from decimal to binary first
Dammit! Someone wrote up the nodeshell before me. Ah well, I'll write my version, and they can fight it out.

Write your binary number down. Here's mine:

11010111
Now, divide it up into groups of three, starting at the right. If the leftmost group has less than three letters in it, put zeroes at the start to make it up to three.

011 010 111
Now, this is similar to Binary to Hexadecimal. For each group of three characters, write numbers underneath. Start at the right, with 1, then double it (2) and write that below the middle digit then double that (4) and write it below the leftmost digit. Example:

011 010 111
421 421 421
Now multiply the top by the bottom for each digit, i.e.

011 010 111
421 421 421
021 020 421
Next, go along the bottom line, adding together the groups of three numbers:
021 020 021

0 + 2 + 1 = 3
0 + 2 + 0 = 2
4 + 2 + 1 = 7
  3   2   7
These are the octal numbers for the little groups of three binary digits. Now, if we squash them into one long number:
327
And there we have it; 11010111 Binary = 327 Octal

If you don't understand this, I'd check out my Binary to Hexadecimal node. It has better examples.

Log in or registerto write something here or to contact authors.