Digits of a number between 0 and 1.

656 Views Asked by At

I'm currently working on a problem that requires me to know, for some $x=.x_1x_2x_3....x_n \in [0,1]$, when the $nth$ digit is equal to $0$ or $1$, in base $2.$ For example the interval where $x_1 = 1$ in base $2$ is $[\frac{1}{2}, 1)$, I think. And $x_2=1$ between $0$ and $\frac{1}{4}$ and also between $\frac{3}{4}$ and $1$. But when the $n$ gets larger, I feel that I should use some kind of pattern, but I'm not sure what to do.

I would like to do the same thing for the numbers in $[0,1]$ in base three.

Any help is appreciated.

2

There are 2 best solutions below

6
On

Sometimes a picture is worth 1000 words.

Regions represented by a $1$ in successive digit places

base 2

enter image description here

base 3

enter image description here

0
On

Let $x$ be the number.

Is the integer part of $2^n x$ odd or even?

If it's odd, the $n$th bit after the binary point is $1$.

If it's even, the $n$th bit after the binary point is $0$.

If you're not convinced, try multiplying a decimal number by $10^n$ and looking at the last digit of its integer part. Then remember that an even binary number ends in $0$.

Multiplying $x$ by $2^n$ just shifts its binary representation to the left by $n$ places.

Dividing by $2^n$ again, your intervals will be based on odd and even multiples of $2^{-n}$.