How can I easily convert between different bases?

  • Thread starter Thread starter mepcotterell
  • Start date Start date
  • Tags Tags
    Base
Click For Summary
Converting between different bases typically involves transitioning through base 10, although direct conversions are possible between bases that are powers of the same number. The discussion highlights methods such as the remainder method and the power method for base conversion. For example, converting from base 2 to base 5 can be done by first converting to base 10 and then using division to find the equivalent in base 5. While base 10 is commonly used due to familiarity, there are more efficient methods for certain base conversions, particularly when dealing with powers of two. Ultimately, finding a comfortable method through practice is essential for effective base conversion.
mepcotterell
Messages
21
Reaction score
0
I know how to convert from any base to any other base but to do so I usually have to go through base 10 with the exception of base 2 to base 16 and vise-versa. I was wondering if you guys know an easy way to convert bases?

The way I usually do it is using the base notation to get base 10 then the remainder method to finish the conversion...

For example to go from base 2 to 5 I would do this...

1011b2 to b10

1*2^0 + 1*2^1 + 0*2^2 + 1*2^3 = 1 + 2 + 0 + 8 = 11

11b10 to b5

11 / 5 = 2 R 1
2 / 5 = 0 R 2

= 21b5
 
Last edited:
Physics news on Phys.org
If you're converting between two bases that are both powers of the same number, then it's possible to do it in 'chunks' because there are locations that have corresponding 'orders'. Consider, for example that the digits base 4 are:
1, 4, 16, 64, and so on
while the digits base 2 are
1,2,4,8,16,32,64 and so on
So it's possible to do 'local' conversion:
Effectively a number base for can be thought of as a polynomial
\sum a_i 4^i
but that's
\sum a_i \left(2^2\right)^i
so
\sum a_i 2^{2i}
and, since 0\leq a_i \leq 3 we have
a_i=b_{2i}*2^0+b_{2i+1}*2^i
so the sum is
\sum (b_{2i}*2^0+b_{2i+1}*2^i)2^{2i}[/tex]<br /> distribute through<br /> \sum b_{2i}^{2i}+b_{2i+1}2^{2i+1}<br /> but that readily regroups to<br /> \sum b_{i}2^i<br /> <br /> It&#039;s a little bit more complicated if you look at, for example, base 9=3^2 and base 27=3^3:<br /> \sum b_{3i} 9^i + b_{3i+1} 9^{3i+1} + b_{3i+2}9^{3i+2}=\sum c_{2j} 27^{2j} + c_{2j+1} 27^{2j+1}<br /> (This is similar to converting from base 9 to base 9^3=729=27^2 to base 27)<br /> <br /> Generally, there is no need to convert numbers to base 10 in order to do base conversion, but, since we&#039;re familiar with arithmetic in base 10, that&#039;s our normal tendency. Similarly, computers, when doing arithmetic computers typically convert into and out of a base that&#039;s some power of two because computers can operate on binary (or hexidecimal) numbers more efficiently. This will look a bit strange, but consider your example:<br /> <br /> Convert<br /> 1011 (base 2)<br /> to base 5<br /> Now<br /> 2^1=1 (base 5)<br /> 2^2=4 (base 5)<br /> 2^3=13 (base 5)<br /> 2^4=31 (base 5)<br /> <br /> Then:<br /> 1101 (base 2) = 1*2^4+1*2^3+0*2^2+1*2^0 (base 5) = 1*31 + 1* 13 + 0 * 4 + 1 * 1 (base 5)<br /> =31+13+1 (base 5)=44+1 (base 5)=100 (base 5)
 



Thank you for sharing your method for converting bases. Your approach using base notation and the remainder method is a common and effective way to convert between bases. Another method that some people find easier is using the power method, where you take the digits of the original number and multiply them by the corresponding power of the base. For example, to convert 1011b2 to b5, you would take the first digit (1) and multiply it by 2^3 (since it is in the 3rd position from the right), then take the second digit (0) and multiply it by 2^2, and so on. This method can be useful for larger numbers or when converting to a base with a larger value. Ultimately, it's important to find the method that works best for you and practice it until you feel comfortable with converting between bases.
 
Thread 'How to define a vector field?'
Hello! In one book I saw that function ##V## of 3 variables ##V_x, V_y, V_z## (vector field in 3D) can be decomposed in a Taylor series without higher-order terms (partial derivative of second power and higher) at point ##(0,0,0)## such way: I think so: higher-order terms can be neglected because partial derivative of second power and higher are equal to 0. Is this true? And how to define vector field correctly for this case? (In the book I found nothing and my attempt was wrong...

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 33 ·
2
Replies
33
Views
4K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 21 ·
Replies
21
Views
1K
  • · Replies 12 ·
Replies
12
Views
11K
  • · Replies 26 ·
Replies
26
Views
779
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K