How can I convert directly between two non-power-of-ten bases?

Click For Summary
SUMMARY

This discussion focuses on the complexities of converting numbers between non-power-of-ten bases, specifically addressing challenges with negative and fractional bases. The user outlines a method for converting from base 10 to another base using logarithmic calculations and successive Euclidean divisions. They also describe the process for converting between bases that are powers of each other. The conversation highlights the difficulty of directly converting between two arbitrary bases, such as base 2 and base 3, and provides a specific example of representing the fraction 2/3 in base 1/2.

PREREQUISITES
  • Understanding of logarithmic functions, specifically log base conversions
  • Familiarity with Euclidean division for base conversion
  • Knowledge of fractional and negative bases in numeral systems
  • Basic concepts of number representation in various bases
NEXT STEPS
  • Research "Logarithmic base conversion techniques" for deeper insights
  • Study "Euclidean division and its applications in base conversion"
  • Explore "Negative base numeral systems" for advanced understanding
  • Investigate "Fractional base representation" to handle non-integer values
USEFUL FOR

Mathematicians, computer scientists, and educators interested in numeral systems, particularly those dealing with base conversions and representations in non-standard bases.

caters
Messages
229
Reaction score
10
I can most of the time successfully convert between base 10 and another base or another base and base 10 or between 2 bases where one of them is a power of the other(like base 2 and base 4 or base 3 and base 9).

With negative bases I sometimes don't get what I want in that negative base and with fractional bases there are 2 expansions for every rational number greater than or equal to 1, They are an infinite sequence of digits to the left and a terminating or repeating decimal to the right. But how will I know if it is a repeating decimal and what repeats in that repeating decimal?

Like what if I wanted to represent 2/3 in base 1/2?

Also I don't know of an easy way to convert between 2 bases that are not powers of each other or base 10 and another base.

Here is how I convert between base 10 and another base:

1) ##log_n(x) = y## Here n is the base I want to convert to and x is the base 10 number I want to convert.

2) ##y =## some irrational number ##y' =## Just the integer and not the whole irrational

3) ##\frac{x}{n^{y'}}##

4) Write down the integer part(which is equal to ##z##) as the digit in the ##n^{y'}## place

5) ##z*n^{y'}##

6)##x-(z*n^{y'})##

7) repeat until you reach the ##n^0## place

8) If needed extend it to decimals in base ##n##.

When I convert between 2 bases that are powers of each other I start from the right and make n groups of ##log_x(y)## digits where ##x## is the current base and ##y## is a power of that base. I then take those groups as if they were individual numbers themselves, add up their values and write down their values from right to left

But how can I convert directly between 1 base and another base when it is neither one of these 2 previous scenarios like for example converting directly from base 2 to base 3?
 
Mathematics news on Phys.org
If you want to convert a positive integer from base 10 to base b (b integer greater than 1), you can do it by successive euclidean divisions :

## n = b q_0 + r_0 ##
## q_0 = b q_1 + r_1 ##
...
## q_{k-1} = b q_k + r_k ##
...
until the quotient is 0.
In the end, ##n = \sum_{k=0}^m r_k b^k ##. So, collecting the remainders gives you the conversion from base 10 to b : ##(n)_b = (r_m...r_0)##

If you want to convert from base b to c, the only option I know (and I don't know much), you can go from base b to 10 and from base 10 to c.

Assume that you now you have a positive real number in base 10 with fractional part x, and you want to convert x to base b, so that ## x = \sum_{k=1}^p s_k b^{-k} ##. An algorithm that gives you the ##s_k## is :

## s_1 = \lfloor bx \rfloor, x \leftarrow bx - s_1 ##
...
## s_k = \lfloor b x\rfloor, x \leftarrow bx - s_k ##
until ##x=0##

But I have the feeling you already know that, and probably better than me :confused:
 
For the specific case "write 2/3 in base 1/2", start by noting that 2/3 is larger than 1/2. But 2/3- 1/2= 1/6 which is less than 1/2 so the first "digit" right of the "decimal" point is 1: it starts "0.1...". Now note that (1/2)^2= 1/4 is larger than 1/6. The next place is 0: we have "0.10...". (1/2)^3= 1/8 is less than 1/6 and 1/6- 1/8= 2/48= 1/24 is less than 1/2: now we have "0.101...". (1/2)^4= 1/16 is larger than 1/24 so the next place is 0: "0.1010...". Continue like that. Of course, this will be a non-terminating "decimal".

(I put words like "digit" and "decimal" in quotes because those names are, of course, derived from the Greek "deci" for one-tenth and don't really apply to other bases.)
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K