Results 1 to 4 of 4
Like Tree2Thanks
  • 2 Post By Soroban

Math Help - convertion between numeral systems

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

    convertion between numeral systems

    Hi guys.
    i'm new here.
    English isn't my first language, so you'd have to forgive me for any mistakes you might find...

    I couldn't find more suitable place to post it, and i hope this is the right forum for my question...

    So, i want to be able to convert numbers from one base to another.
    i know how to do it from any given (decimal) number, to any other base.

    Say i want to convert the number 347:

    347/6=57, R=5
    56/6=9, R=3
    9/6=1, R=3
    1/6=0, R=1

    So 347_{10}=1335_{6} (the remainders).

    and the other direction:

    1335_{6}=5\cdot6^0+3\cdot6^1+3\cdot6^2+1\cdot6^3=3  47_{10}

    (the reason i'm showing the calculation here is because i would love to hear about a better, faster way to convert numbers from base to base)

    my problem is:
    i want to be able to convert numbers from base to base directly.
    for example: if i want to convert 1335_{6} to an octal, eight based number, i first need to convert to 347_{10}, and only then i'm able to convert to an octal number.

    is there a way to skip the decimal conversion part and go straight to the octal number?
    if so, how can it be done?

    thanks in advanced, and have a nice day!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member

    Joined
    May 2006
    From
    Lexington, MA (USA)
    Posts
    11,749
    Thanks
    649

    Re: convertion between numeral systems

    Hello, Stormey!

    I want to be able to convert numbers from base to base directly.

    For example: if i want to convert 1335_{6} to an octal, base-8 number,
    I first need to convert to 347_{10}, and only then i'm able to convert to an octal number.

    Is there a way to skip the decimal conversion part and go straight to the octal number?
    If so, how can it be done?

    It can be done, but you must be able to do the division in base-6.


    It looks like this . . .

    . . \begin{array}{ccccccc} &&&& 1&1&1_6 \\ &&& --&--&--&-- \\ 1&2_6&|&1&3&3&5_6 \\ &&& 1&2 \\ &&& --&-- \\ &&&& 1&3 \\ &&&& 1&2 \\ &&&& --&-- \\ &&&&& 1&5 \\ &&&&& 1&2 \\ &&&&& --&-- \\ &&&&&&3 \end{array} \quad \boxed{R\,=\,3}


    . . \begin{array}{cccccc} &&&&& 5_6 \\ &&& --&--&-- \\ 1&2_6&|&1&1&\;1_6 \\ &&& 1&0&4 \\ &&& --&--&-- \\ &&&&& 3 \end{array} \quad \boxed{R\,=\,3}


    . . \begin{array}{cccc} &&& 0_6 \\ &&& -- \\ 1&2_6&|&5_6 \\ &&& 0\; \\ &&& -- \\ &&&5 \end{array} \quad \boxed{R \,=\,5}


    Therefore: . 1335_6 \;=\;533_8
    Thanks from MarkFL and Stormey
    Follow Math Help Forum on Facebook and Google+

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

    Re: convertion between numeral systems

    Hi, Soroban!

    briliant.
    didn't think about it...
    but the truth is i'm supposed to write an algorithm for it, and since the compiler only divides in decimal base, it seems now that division in base 6 (or any other base besides decimal, for that matter) will require some more work.
    i'll need another algorithm for a predesignated function that divides numbers in any given base (defined by the user).
    thats just going to complicate things, and therfore leaves me with the first idea:
    a two steps conversion (from x based number to decimal, and from decimal to y based number).

    thanks for the help, and have a nice day!
    Last edited by Stormey; November 21st 2012 at 12:58 PM.
    Follow Math Help Forum on Facebook and Google+

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

    Re: convertion between numeral systems

    Hi Soroban.
    after seeing that two conversions isn't a picnic either, i'll need to consider it after all.

    so i just need to ask something:
    you said that the division needs to be in base-6. why did you divided 1335 by 12 and not by 6?

    edit.

    OK... i see what you did there... 8_{10}=12_6
    Last edited by Stormey; November 23rd 2012 at 01:47 AM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 1
    Last Post: August 27th 2009, 01:33 PM
  2. Convertion from Multiplication to Addition
    Posted in the Algebra Forum
    Replies: 1
    Last Post: April 1st 2009, 06:23 PM
  3. Complex base numeral systems?
    Posted in the Number Theory Forum
    Replies: 5
    Last Post: October 24th 2008, 11:48 PM
  4. Roman Numeral<-->Number Converter
    Posted in the Math Software Forum
    Replies: 0
    Last Post: July 5th 2008, 11:15 PM
  5. another convertion question
    Posted in the Calculus Forum
    Replies: 3
    Last Post: April 15th 2008, 02:51 PM

Search Tags


/mathhelpforum @mathhelpforum