Given dividend and divisor, can we know the length of nonrepeating part and repeating part?

Given the reduced rational number $\frac{p}q$, you are seeking the smallest number of the form $10^n\left(10^r-1\right)$ which is divisible by $q$. Then there are $n$ non-repeating digits and $r$ repeating digits.

In particular, it only depends on $q$, not $p$ (assuming they are relatively prime.) That would make your answer for $13/92$ wrong.

So, if we write $q=2^a5^bq'$ where $\gcd(q',10)=1$, then we have $n=\max(a,b)$, and we'd have $r$ to order of $10$ modulo $q'$, which will be a divisor of $\mathbb \phi(q')$.

It is elementary if we know $n,r$ that $10^n(10^r-1)\frac{p}{q}$ must be an integer - that is the grade-school method for figuring out the value of a repeating decimal.

For example, if $p=1,q=5\cdot 37$, then $n=1$ and $r$ is the smallest value such that $10^r-1$ is divisible by $37$, which turns out to be $3$. And that's what we get: $$\frac{1}{5\cdot 37} = 0.0\overline{054}$$

Another example: $p=5,q=2^3\cdot 3\cdot 7$. Then $n=3$ and $q'=21$. That means that $r$ must be a divisor of $\phi(21)=12$. Actually, we can show it must be a divisor of $6$, and is $6$ since $1/7$ has repeating sequence of $6$. And, indeed:

$$\frac{5}{168} = 0.029\overline{761904}$$


You mean "are relatively prime" in your third point?

In general, take any non-negative rational $r = \frac{p}{q}$ such that $\gcd(p,q) = 1$.

Let $a,b,c \in \mathbb{N}$ such that $q = 2^a 5^b c$ and $\gcd(c,10) = 1$.

Then $10^{\phi(c)} \equiv 1 \pmod{c}$, by Fermat's little theorem.

Let $k = ord_c(10) = \min \{ x : x \in \mathbb{N}_{>0} \wedge 10^x \equiv 1 \pmod{c} \}$.

Then $k \mid \phi(c)$, but in general is hard to compute.

Let $m = \max(a,b)$.

Then $q \mid (10^k-1)10^m$.

Let $n = p \dfrac{(10^k-1)10^m}{q} \in \mathbb{N}$.

Let $s,t \in \mathbb{N}$ such that $n = (10^k-1)s+t$ and $0 \le t < 10^k-1$.

Then $r = \dfrac{n}{(10^k-1)10^m} = 10^{-m} ( s + t \sum_{i=1}^\infty 10^{-ik} ) $.

If $r < 1$, $r = 0.s\overline{t}$ where $s,t$ are padded with zeros if necessary to total $m,k$ digits respectively.

Now the remaining question is whether the last part of $s$ concides with the last part of $t$, which would mean that the repeat starts earlier than after $m$ decimal places. That is not possible because any repeating decimal can be expressed as a fraction with denominator of that same form (power of ten times one less than another power of ten), which would contradict the minimality of $k$ and $m$ above.