1
$\begingroup$

How can I choose an $x\in[a,b)\subseteq[0,1)$, where $a,b\in\mathbb{Q}$, such that $x$ has a non-repeating fractional part in some chosen base?

For example, say I'm looking at $[\frac{1}{2},\frac{3}{4})$ and I'm working in base 10. I could pick $x=\frac{2}{3}$, but that has a repeating fractional part in base 10, so I'd choose $x=\frac{1}{2}$. Is there an algorithmic method that works in general? (If it helps, the problem I'm trying to solve is in base 2.)

As a bonus question, is there a way of choosing $x$ such that its fractional part has a minimal length? So, following the above example, $\frac{1}{2}=0.5$ would be "better" than $\frac{5}{8}=0.625$.

1 Answers 1

4

Consider numbers of the form $x = \frac{p}{q^n}$ where $q$ is your base. Surely with $n$ big enough you can pick $p$ to be inside $[aq^n,bq^n)$.

If you want an algorithmic approach, just multiply $a$ and $b$ by $q^n$ with increasing $n$ until you will find an integer between them. In base two it is even simpler, just take the binary representation of $a$ and $b$ and find the first place where they differ, and then find the first number $x_1 \geq a$ or $x_2 < b$.

a  = 0100011011010010111111010110110(110)... b  = 0100011011010011001100110011001(1001)...                     ^ first difference x1 = 01000110110100101111111                            ^ difference from a x2 = 0100011011010011000                        ^  difference from b                          (of course remove the trailing zeros) 

Cheers!