|
|
|
|
| View previous topic :: View next topic |
| Author |
Message |
Alfie
Bovine Member
|
Posted: Wed Feb 23, 2000 1:25 am Post subject: 1 |
|
|
The question has been asked:
How do you convert from one number system to another without going through base 10.
I will start with base 2 to base 4.
This is a special case that makes life soooo easy.
First you look at the number:
1100101
Then you break it into sets of two, starting at the units digit:
1 10 01 01
Then find each set in decimal:
1 2 1 1
String the result together:
1211
This is the number in base 4.
It works for base x to base x^n for natural numbers n and x and x>1.
You take n digits of the number. Convert them to decimal and string them together. (This assumes that x^n<10. Things get hairy after that.)
Example:
base 3 122110 to base 9
12 21 10
5 7 3
573
(Note: This section had been edited to avoid going through base ten. I messed up )
Now for the trickier stuff. Like base 3 to base 7. You don't actually have to go through base 10 to get to base 7. You just have to think a little different.
Like this:
base 3 112210 to base 7
Break it down like you always do:
0*1
1*3
2*9
2*27
1*81
1*243
But do the math in base 7.
0*1=0
1*3=3
2*12=24
2*36=105
1*144=144
1*465=465
Then add them:
code:
3 53 53
0 0 0 0
3 3 3 3
24 24 24 24
105 105 105 105
144 144 144 144
+465 +465 +465 +465
---- ---- ---- ----
0 10 1110
You add the ones carry 3. Add the sevens carry 5. Add the 49s and get 11. It works like regular addition.
To take matters one step farther lets look at base 16. It is an excellent example of a numbering system beyond ten. It works like any other system, but it needs for than 10 digits. So we go to the alphabet. We need six additional digits so we get A,B,C,D,E,F. So working in bases above ten is like working in other bases with more digits.
In order to apply method one with bases greater than ten you must take one additional step. After you find the number in decimal, you convert it so that it is only one digit.
A=10
B=11
C=12
D=13
E=14
F=15
Example:
base 2 11011110101011011011111011101111 to base 16
Separate them out:
1101 1110 1010 1101 1011 1110 1110 1111
Convert:
13 14 10 13 11 13 13 15
Then convert:
D E A D B E E F
Then string them together:
DEADBEEF
That is the number in base 16.
This information can be applied to method two as well. Just remember to convert any multiple digit answers correctly. In order to avoid going through base 10, simply go straight from:
1101 1110 1010 1101 1011 1110 1110 1111
To:
D E A D B E E F
And string it together.
The key to the whole thing it being able to think in a different numbering system.
Next is converting a number from a higher base to a lower base. For base 7 to base 3, use the same technique as above:
1110 in base 7 to base 3:
0*1=0
1*21=21
1*1211=1211
1*110201=110201
Sum:
code:
1 11 111 111 111
0 0 0 0 0
21 21 21 21 21
1211 1211 1211 1211 1211
+110201 +110201 +110201 +110201 +110201
------- ------- ------- ------- -------
0 10 210 2210 112210
And you have it.
To convert to from base x^n to base x, do the reverse of the above process:
1211 in base 4 to base 2(n=2)
Spread the digits out:
1 2 1 1
Convert them to base 2(easy enough) making sure to include 0’s to make each unit two digits:
01 10 01 01
String them together(removing the leading 0)
1100101
The same process works for high number bases like:
256CEDE in base 16 to base 2(n=4)
Split:
2 5 6 C E D E
Convert: (This is a little tougher, use the decimal chart for ABCDEF if you have to.)
0010 0101 0110 1100 1110 1101 1110
String them together:
10010101101100111011011110
Basically the only reason to go through base ten is if you can’t do math in base 36. This completes this simple guide unless I forgot something or I messed up.
[This message has been edited by Alfie (edited 02-25-2000).] |
|
| Back to top |
|
 |
Ghost Post
Icarian Member
|
Posted: Wed Feb 23, 2000 3:24 am Post subject: 2 |
|
|
Thanks for posting alfie, i looked at this quickly as i don't have much time tonight, but i printed it out so i can look at it more closely later. i see what you do, but now im going to try to see why. i'll be back tomorrow to see if youve posted more.  |
|
| Back to top |
|
 |
Ghost Post
Icarian Member
|
Posted: Wed Feb 23, 2000 6:51 pm Post subject: 3 |
|
|
Alfie- i see how the first method works and why. As for the second, after you break it down in base 3, then you say to do the math in base 7.
0*1
1*3
2*9
2*27
1*81
1*243
so do i just go well in base 3, 2*9 is 18 , and in base 7, 18 is 24?
Also I cant figure out why this works yet, do you have an easy way of explaining it or a proof or something to look at?
Also thanks again for taking time to explain this.
|
|
| Back to top |
|
 |
Ghost Post
Icarian Member
|
Posted: Fri Feb 25, 2000 1:41 pm Post subject: 4 |
|
|
| I'd still say you're going through base 10. If you go from base 3 to base 7 directly, you should never see any digit greater than 6. |
|
| Back to top |
|
 |
CrystyB
Misunderstood Guy
|
Posted: Sun Mar 05, 2000 11:46 am Post subject: 5 |
|
|
Well, you could say instead of 9, 27, etc 3^2, 3^3 and so on. Now, in respect to base 7: 3^2=12, 3^3=36,... and 3+2*12+2*36+144+465=3+24+102+144+465=30+246+465=306+465=1104. Whew.
And that doesn't use tenth base. IF you have the handy-dandys:
code:
+ 0 1 2 3 4 5 6 * 0 1 2 3 4 5 6
0 0 1 2 3 4 5 6 0 0 0 0 0 0 0 0
1 1 2 3 4 5 6 10 1 0 1 2 3 4 5 6
2 2 3 4 5 6 10 11 2 0 2 4 6 11 13 15
3 3 4 5 6 10 11 12 3 0 3 6 12 15 21 24
4 4 5 6 10 11 12 13 4 0 4 11 15 22 26 33
5 5 6 10 11 12 13 14 5 0 5 13 21 26 34 42
6 6 10 11 12 13 14 15 6 0 6 15 24 33 42 51
Well, for BACK from 7 to 3, you FIRST convert 7 to 21 then do 21^2, 21^10 (!!!) 21^11, and so on. No base ten involved either. |
|
| Back to top |
|
 |
Quailman
His Postmajesty
|
Posted: Tue Mar 07, 2000 3:03 pm Post subject: 6 |
|
|
Interesting observation on the method to convert base 2 to base 4 without going through base 10 (even though your process states "Then find each set in decimal:"):
This also works for base 4 to base 16 (4^2). The example given - 1211 - reduces to 65 if you break it into 12 and 11. All these numbers equal 101 in base 10.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|