Results 1 to 5 of 5
Like Tree2Thanks
  • 1 Post By SlipEternal
  • 1 Post By SlipEternal

Math Help - Moving from one numeral system to another...

  1. #1
    Member
    Joined
    Nov 2012
    From
    israel
    Posts
    164
    Thanks
    2

    Moving from one numeral system to another...

    Hi.
    Hope it's the right place to post it (if not - please move it to the right forum).
    I have a question regarding the transfer between numeral systems.

    the way to convert, for example, the binary number 101011001_{2} to decimal will be:

    101011001_{2}= 1\cdot 2^8+0\cdot 2^7+1\cdot 2^6+0\cdot 2^5+1\cdot 2^4+1\cdot 2^3+0\cdot 2^2+0\cdot 2^1+1\cdot 2^0=345_{10}

    and, if I want to go back to a binary number:

    345_{10} : 2 = 172_{10} , r=1_{2}
    172_{10} : 2 = 86_{10} , r=0_{2}
    86_{10} : 2 = 43_{10} , r=0_{2}
    43_{10} : 2 = 21_{10} , r=1_{2}
    21_{10} : 2 = 10_{10} , r=1_{2}
    10_{10} : 2 = 5_{10} , r=0_{2}
    5_{10} : 2 = 2_{10} , r=1_{2}
    2_{10} : 2 = 1_{10} , r=0_{2}
    1_{10} : 2 = 0_{10} , r=1_{2}

    concatenating all the remainders togather, we'll get: 101011001_{2}

    now, I do understand the logic behind this operations, but one thing is bothering me:
    let's say I want to convert the same binary number to a 5-based (or even a 6 or a 7-based) number.
    the only way to do it is to first convert 101011001_{2} to 345_{10} with the same method above, and only then to convert 345_{10} to 2340_{5} (using the second method, with the remainders).

    Why isn't there a way to directly convert 101011001_{2} to 2340_{5}?
    What is stoping me from doing that?

    Hope the the question is clear enough.
    thanks in advanced.
    Last edited by Stormey; October 20th 2013 at 03:02 AM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Nov 2010
    Posts
    1,930
    Thanks
    782

    Re: Moving from one numeral system to another...

    Quote Originally Posted by Stormey View Post
    Hi.
    Hope it's the right place to post it (if not - please move it to the right forum).
    I have a question regarding the transfer between numeral systems.

    the way to convert, for example, the binary number 101011001_{2} to decimal will be:

    101011001_{2}= 1\cdot 2^8+0\cdot 2^7+1\cdot 2^6+0\cdot 2^5+1\cdot 2^4+1\cdot 2^3+0\cdot 2^2+0\cdot 2^1+1\cdot 2^0=345_{10}

    and, if I want to go back to a binary number:

    345_{10} : 2 = 172_{10} , r=1_{2}
    172_{10} : 2 = 86_{10} , r=0_{2}
    86_{10} : 2 = 43_{10} , r=0_{2}
    43_{10} : 2 = 21_{10} , r=1_{2}
    21_{10} : 2 = 10_{10} , r=1_{2}
    10_{10} : 2 = 5_{10} , r=0_{2}
    5_{10} : 2 = 2_{10} , r=1_{2}
    2_{10} : 2 = 1_{10} , r=0_{2}
    1_{10} : 2 = 0_{10} , r=1_{2}

    concatenating all the remainders togather, we'll get: 101011001_{2}

    now, I do understand the logic behind this operations, but one thing is bothering me:
    let's say I want to convert the same binary number to a 5-based (or even a 6 or a 7-based) number.
    the only way to do it is to first convert 101011001_{2} to 345_{10} with the same method above, and only then to convert 345_{10} to 2340_{5} (using the second method, with the remainders).

    Why isn't there a way to directly convert 101011001_{2} to 2340_{5}?
    What is stoping me from doing that?

    Hope the the question is clear enough.
    thanks in advanced.
    It is because you are used to dealing with base-10 numbers. You don't even realize that you are actually going through the same process when you convert to base-10 that you did to convert to base-2.

    The expression 101011001_{2}= 1\cdot 2^8+0\cdot 2^7+1\cdot 2^6+0\cdot 2^5+1\cdot 2^4+1\cdot 2^3+0\cdot 2^2+0\cdot 2^1+1\cdot 2^0 is not in base-10. You then have to add everything up and put it in base-10. You find it easy to add things this way because you are used to base-10 operations. If you were used to adding numbers in other bases, you might just as easily dismiss the following addition: 345_{10} = 3\cdot 10^2 + 4\cdot 10^1 + 5\cdot 10^0 = 3_5\cdot (20_5)^{2_5} + 4_5\cdot (20_5)^{1_5} + 10_5\cdot (20_5)^{0_5} = 2340_5. This process is the exact same process you used for converting the binary number to base-10, but it might not look right because it is not in base-10. In base-10, the process we are taught for addition is to add up a column of digits, record the units place of the sum and "carry" the rest of the digits one column to the left. This is the same as taking the remainder when the sum is divided by 10.

    So, you can certainly convert directly from one base to another, so long as you are comfortable with the arithmetic operations of that base.

    Edit -- Here is an example of going from base-2 to base-7 without stopping at base-10:

    \begin{align*}(2_7)^{0_7} & = 1_7 \\ (2_7)^{1_7} & = 2_7 \\ (2_7)^{2_7} & = 4_7 \\ (2_7)^{3_7} & = 11_7 \\ (2_7)^{4_7} & = 22_7 \\ (2_7)^{5_7} & = 44_7 \\ (2_7)^{6_7} & = 121_7 \\ (2_7)^{10_7} & = 242_7 \\ (2_7)^{11_7} & = 514_7 \\ \\ 101011001_2 & = 1_7\cdot (2_7)^{11_7} + 0_7\cdot (2_7)^{10_7} + 1_7\cdot (2_7)^{6_7} + 0_7\cdot (2_7)^{5_7}+1_7\cdot (2_7)^{4_7}+1_7\cdot (2_7)^{3_7}+0_7\cdot (2_7)^{2_7}+0_7\cdot (2_7)^{1_7}+1_7\cdot (2_7)^{0_7} \\ & = 514_7 + 121_7 + 22_7 + 11_7 + 1_7\end{align*}

    \begin{matrix} \scriptstyle{1} & \scriptstyle{1} & \scriptstyle{1} & \\ & 5 & 1 & 4_7 \\ & 1 & 2 & 1_7 \\ & & 2 & 2_7 \\ & & 1 & 1_7 \\ + & & & 1_7 \\ \hline 1 & 0 & 0 & 2_7\end{matrix}
    Last edited by SlipEternal; October 20th 2013 at 08:56 AM.
    Thanks from Stormey
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member
    Joined
    Nov 2012
    From
    israel
    Posts
    164
    Thanks
    2

    Re: Moving from one numeral system to another...

    Brilliant.
    Just the answer I was looking for (it didn't occur to me that the arithmetic itself also needs to be converted to the new base...).
    Thanks, SlipEternal.

    Just one more thing:

    Quote Originally Posted by SlipEternal View Post
    If you were used to adding numbers in other bases, you might just as easily dismiss the following addition: 345_{10} = 3_5\cdot (20_5)^2 + 4_5\cdot (20_5)^1 + 10_5\cdot (20_5)^0 = 2340_5.
    Shouldn't it be 345_{10} = 3_5\cdot (10_5)^2 + 4_5\cdot (10_5)^1 + 10_5\cdot (10_5)^0 = 2340_5,
    since the number inside the parentheses is the base to which we are converting?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Joined
    Nov 2010
    Posts
    1,930
    Thanks
    782

    Re: Moving from one numeral system to another...

    Quote Originally Posted by Stormey View Post
    Shouldn't it be 345_{10} = 3_5\cdot (10_5)^2 + 4_5\cdot (10_5)^1 + 10_5\cdot (10_5)^0 = 2340_5,
    since the number inside the parentheses is the base to which we are converting?
    In base-5, the number 10 is 2\cdot 5 = 2\cdot 10_5 = 20_5.

    Edit: This might help visualize what is happening a little better:
    345_{10} = 3\cdot 10^2 + 4\cdot 10^1 + 5\cdot 10^0 = 3_5\cdot (20_5)^{2_5} + 4_5\cdot (20_5)^{1_5} + 10_5\cdot (20_5)^{0_5} = 2340_5

    Also, I updated my post above to include an example of converting directly from base-2 to base-7.
    Last edited by SlipEternal; October 20th 2013 at 08:58 AM.
    Thanks from Stormey
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Member
    Joined
    Nov 2012
    From
    israel
    Posts
    164
    Thanks
    2

    Re: Moving from one numeral system to another...

    Beautiful, thank you!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. convertion between numeral systems
    Posted in the Discrete Math Forum
    Replies: 3
    Last Post: November 23rd 2012, 01:29 AM
  2. Replies: 0
    Last Post: April 25th 2010, 08:23 AM
  3. Replies: 1
    Last Post: August 27th 2009, 01:33 PM
  4. Complex base numeral systems?
    Posted in the Number Theory Forum
    Replies: 5
    Last Post: October 24th 2008, 11:48 PM
  5. Roman Numeral<-->Number Converter
    Posted in the Math Software Forum
    Replies: 0
    Last Post: July 5th 2008, 11:15 PM

Search Tags


/mathhelpforum @mathhelpforum