How can I convert directly between two non-power-of-ten 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.)
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
I'm interested to know whether the equation $$1 = 2 - \frac{1}{2 - \frac{1}{2 - \cdots}}$$ is true or not. It can be shown easily that if the continued fraction converges, it cannot converge to anything else than 1. It seems that if the continued fraction converges, the convergence is very slow. The apparent slowness of the convergence makes it difficult to estimate the presence of true convergence numerically. At the moment I don't know whether this converges or not.

Similar threads

Back
Top