Is there a patterns in the repetend of prime reciprocals? Given a prime $p\ge7$ where $\frac1p$'s repetend (recurring figures of the repeating decimal) in base-10 be $\frac1p$ is $\underline{a_1a_2\cdots a_i}$ where $2|i$. Let the number of digit that is interger $k(1\le k\le9)$ in $\underline{a_1a_2\cdots a_i}$ be $t_k$. Is it true that $t_a=t_b$ fot all non-negative integers $a$ and $b$ when $a+b=9$.
For example, if $p=7$, the repetend of $\frac17$ is $142857$. So we have $t_1=t_2=t_4=t_5=t_7=t_8=1$. Therefore for all $a$, $b$ that satisfies the question, we have: $t_0=t_9=0$, $t_1=t_8=1$, $t_2=t_7=1$, $t_3=t_6=0$, $t_4=t_5=1$. Therefore the problem is true for when $p=7$.
I wanted to know if this is true for all $p\ge7$.
 A: The key here is whether the multiplicative order of $10$ modulo $p$ is odd or even, or equivalently, whether the period length is odd or even.  You can see from that link that it’s even for the first few primes above $7$, which is why it may have looked like it was true for most primes.
If the order is even, say equal to $2k$, then $10^k \equiv -1 \pmod p$, and the repetend will consist of some $k$-digit number, followed by $99...9$ ($k$ digits) minus the same number; e.g. $142$ followed by $999-142 = 857$.  The idea is that multiplying by $10^k$ (shifting by $k$ positions) corresponds to negation mod $p$.
This forces the pattern you observed, since each digit $a$ is followed by $9-a$ exactly $k$ positions further down.
On the other hand, if the period is odd then it’s impossible for your observation to hold for all digits since it requires an even number of total occurrences.  So it’s an if and only if: for instance $1/37 = 0.027027027\ldots$, and the $0$s are not balanced with the (non-existent) $9$s.
Can we predict when the order of $10$ will be odd or even?  In some ways, yes.  For instance, we can take an odd-length repunit like $11111$, and each of its prime factors (41, 271) is guaranteed to yield an order that divides into $5$, hence is odd.
We can also make some predictions using quadratic reciprocity: if $(10/p) = -1$ then the order of $10$ mod $p$ is sure to be even, and if $(10/p) = +1$ for a prime $p \equiv 3 \pmod 4$, then the order is sure to be odd.  So in those cases the behavior is determined entirely by the congruence class of $p$ mod $40$.  But I’d guess it’s more delicate when $p \equiv 1, 9, 13, 37 \pmod{40}$, when neither situation holds.
Indeed, the period of $1/41$ is $5$, but $1/241$’s is $30$.  $1/13$ has period $6$, but $1/53$ has period $13$.  $1/37$ has period $3$, but $1/277$ has period $69$.
Curiously, I couldn’t find a small example of a prime of the form $40k+9$ that has odd period.  Maybe I made a miscalculation, or there’s something else going in that residue class...
EDIT: After asking around, we found $1/89$ has period $44$ and $1/1609$ has period $201$.
