Artificial intelligent assistant

Algorithm for converting fraction into (recurring) decimal I need to determine whether fraction is recurring decimal or not (what are conditions for it?), find period and output it as $\frac{1}{3}=0.\bar{3}$. If it is not recurring, then I already have algorithm.

Notice that if you have a repeating decimal $$n=0.\overline{D_1D_2...D_k}$$ where each $D_i$ is a digit, you can say that $$10^k n=D_1D_2...D_k.\overline{D_1D_2...D_k}$$ and so $$10^k n-n=D_1D_2...D_k$$ and $$n=\frac{D_1D_2...D_k}{10^k-1}$$ This means that $n$ can only be a repeating decimal if $n$ can be expressed in the form $$n=\frac{a}{10^b-1}$$ and so if you are given a number in the form $$I+\frac{h}{j}$$ Where $I$ is an integer and $j\gt h$, then it can only be a repeating decimal if $j$ evenly divides $10^k-1$ for some $k$. For example, for $j=1,2,5,10$ it will never be a repeating decimal.

Does this help?

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 0c231ee735442adaea3e4363e6a1005c