Question:
Find $n\in \mathbb N$ such that $n \gt 1$ and the binary expansion of $\frac{1}{n}$ terminates.
My try:
I know an algorithm for writing the binary expansion.
Step 1: Consider $n \in \mathbb N$ and $A \in (0,1)$
Step 2: For $i$ from $1$ to $n$, do the following, as long as $A>0$.
Sub-step 2-1: $a \leftarrow[2A]$
Sub-step 2-2: Write $a$
Sub-step 2-3: $A \leftarrow2A-a$
For a binary expansion to terminate by this method, I need to be sure that in the $n$ iterations, $A$ doesn't take repetitive values. (For example, It shouldn't be equal to $0.2$, Both at the 3rd and 5th iterations)
But i don't know how to make sure that this never happens.
Note: The point is not finding just $1$ number.Finding a sufficient condition for $A$ to not be repetitive, matters.
Any idea?