Yes! By hand, you'll probably want to take it through Base 10. Just remember that the kth digit in a base n number is that many multiples of n**k. So base 8, from right to left, is 1,8,64,512,4096.... and base 6 is 1,6,36,216,1296... . A quick example:
314_8 = (3*64)+(1*8)+(4) = 204_10
204 is less than 216, so we only need 3 digits in base 6. But it's not a 32 less, so it'll be 5xx_6 204-(36*5)=24, which is 4*6. 314_8=204_10=540_6
This is actually relevant to me this week, since my discrete math homework this week includes a problem in base -2 (where the digits go 1,-2,4,-8,16,-32...). We have to provide an efficient algorithm to perform subtraction.
See, that would be how I'd do it if I had a choice, but my comp sci professor wants to make sure we understand the concept of positional notation, which means writing out a lot of tedious arithmetic.
Barring an invasion of alien Count Rugens, are there cases in CS (or anywhere) in which base 6 is relevant, or is this just an exercise? I checked the Wikipedia page on senary and didn't see anything that convinced me that base 6 is super-important.
My usual conversion method is to divide (long-division, yay!) by the target base, in the source base. Your remainder is the last digit in the new base. Repeat with the result to get the rest of the digits.
So 12348 / 6 = 1578, remainder is 2. 1578 / 6 = 228, remainder is 3. 228 / 6 = 3, remainder is 0. 38 / 6 = 0, remainder is 3. 12348 = 30326.
I realize this is the hard way to do it. It's certainly easier if your source base is one you're comfortable with, such as decimal.
You beat me to it! But you didn't include this song (http://popup.lala.com/popup/3459046010289187476) which makes the point so well (no, it's not Tom Lehrer)
Sorry, I didn't mean your question itself was silly; I was quoting from Tom Lehrer's song about doing arithmetic in base eight. The next line is "Now go back to the 64s...."
Oh, you must. Search for "New Math." The line that inspired my comment in the first place is "But don't worry; base eight is just like base ten --- if you're missing two fingers!"
And, FWIW, I don't know anything by Jonathan Coulton, so we're even. :-)
It's easier if you turn it all into base10 as an intermediate step. Conceptually bases are just power-of-n buckets, so an arbitrary octal number like 4417 is 4*(8^3)+4*(8^2)+1*(8^1)+7*(8^0)=2048+256+32+7=2319 in the base-10 numbers you're used to.
Turning that into a base-6 number, you go by sixes -- rightmost position is 0-5, then multiples of 6, 36, 216, and 1296. 2319/1296 is 1 and 1023 as a remainder. So the first base-six digit is 1, and it's a 5-digit number since we're starting with the fourth power of six (and we count down to zero). 1023 is left, divided by 216 (6 cubed) is 4, leaving 159. 159 divided by 36 (6 squared) is 4 leaving 15 as a remainder. 16 divided by 6 is 2 leaving 3 as a remainder.
4417 base 8 = 14423 base 6.
Let me know if you need further detail or unpacking on any of that.
no subject
Date: 2010-02-11 07:27 pm (UTC)and base 6 is 1,6,36,216,1296... . A quick example:
314_8 = (3*64)+(1*8)+(4) = 204_10
204 is less than 216, so we only need 3 digits in base 6.
But it's not a 32 less, so it'll be 5xx_6
204-(36*5)=24, which is 4*6.
314_8=204_10=540_6
no subject
Date: 2010-02-11 07:30 pm (UTC)no subject
Date: 2010-02-11 07:33 pm (UTC)no subject
Date: 2010-02-11 07:37 pm (UTC)no subject
Date: 2010-02-11 08:43 pm (UTC)no subject
Date: 2010-02-11 10:01 pm (UTC)Here is an insane method.
Date: 2010-02-11 07:49 pm (UTC)So 12348 / 6 = 1578, remainder is 2.
1578 / 6 = 228, remainder is 3.
228 / 6 = 3, remainder is 0.
38 / 6 = 0, remainder is 3.
12348 = 30326.
I realize this is the hard way to do it. It's certainly easier if your source base is one you're comfortable with, such as decimal.
Re: Here is an insane method.
Date: 2010-02-11 10:02 pm (UTC)Re: Here is an insane method.
Date: 2010-02-11 10:15 pm (UTC)no subject
Date: 2010-02-11 07:55 pm (UTC)Chop off one finger from each hand.
Do your arithmetic.
Now chop off one more finger from each hand and do the arithmetic again.
"Ask a silly question...."
no subject
Date: 2010-02-11 08:26 pm (UTC)no subject
Date: 2010-02-11 08:40 pm (UTC)no subject
Date: 2010-02-11 10:03 pm (UTC)no subject
Date: 2010-02-11 10:11 pm (UTC)no subject
Date: 2010-02-11 10:15 pm (UTC)no subject
Date: 2010-02-11 10:17 pm (UTC)And, FWIW, I don't know anything by Jonathan Coulton, so we're even. :-)
no subject
Date: 2010-02-11 10:24 pm (UTC)no subject
Date: 2010-02-12 08:27 pm (UTC)no subject
Date: 2010-02-12 10:16 pm (UTC)no subject
Date: 2010-02-11 07:57 pm (UTC)Turning that into a base-6 number, you go by sixes -- rightmost position is 0-5, then multiples of 6, 36, 216, and 1296. 2319/1296 is 1 and 1023 as a remainder. So the first base-six digit is 1, and it's a 5-digit number since we're starting with the fourth power of six (and we count down to zero). 1023 is left, divided by 216 (6 cubed) is 4, leaving 159. 159 divided by 36 (6 squared) is 4 leaving 15 as a remainder. 16 divided by 6 is 2 leaving 3 as a remainder.
4417 base 8 = 14423 base 6.
Let me know if you need further detail or unpacking on any of that.
no subject
Date: 2010-02-11 07:58 pm (UTC)