I am dealing with things coded as a binary strings. We can think of these as binary expansions of angles on the circle.
Suppose I take something with a repeating binary expansion like $\frac{3}{7} = \overline{011}$. Is there a way to get Mathematica to give me the truncation of length $n$? So say I wanted the length 5 truncation of the above binary expansion, I would get back $01101$.
Is there also a way to get all shifts of the sequence and length $n$ truncations of these?
Example: Take $\overline{011}$ again. This has shifts $\overline{110}$ and $\overline{101}$. Then the level 5 truncations would be $11011$ and $10110$.
For the first part (again for the string $\overline{011}$) I thought about using StringJoin
and some condition like "If $n \equiv 1 \text{ mod} \text{ Length}[``011"]$ then do StringJoin["011","0"]
, if $n \equiv 2 \text{ mod} \text{ Length}[``011"]$ then do StringJoin["011","01"]
etc but this would need some sort of recursive element also, I think.
This seems quite messy and probably tricky to encode in general (especially if our strings get longer). Is there some better way to do this?