This post was interesting enough to make me delurk and offer a few comments.
First, using N
is not really necessary here; RealDigits
is smart enough to handle rational numbers with repeating decimal representations:
Short[rd = RealDigits[1/998001]]
{{{1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 9,
0, 1, 0, 0, 1, 1, 0, 1, 2, 0, 1, 3, 0, 1, 4, 0, 1, 5, 0, 1, 6, 0, 1, 7, 0,
1, 8, 0, 1, 9, 0, 2, 0, 0, 2, 1, <<2876>>, 0, 9, 8, 1, 9, 8, 2, 9, 8, 3,
9, 8, 4, 9, 8, 5, 9, 8, 6, 9, 8, 7, 9, 8, 8, 9, 8, 9, 9, 9, 0, 9, 9, 1, 9, 9,
2, 9, 9, 3, 9, 9, 4, 9, 9, 5, 9, 9, 6, 9, 9, 7, 9, 9, 9, 0, 0, 0, 0, 0}},
<<1>>}
rd[[2]]
-5
which signifies that the decimal form starts out as 0.00000100200…
(five zero digits after the decimal point, and before the first non-zero digit).
For convenience, I'll rotate the digits:
rdrot = RotateRight[rd[[1, 1]], 4];
for a more convenient representation:
FromDigits @ {{rdrot}, -1}
1/998001
Note that
Length[rdrot]
2997
which is a multiple of 3,
Divisible[%, 3]
True
and this length can be computed like so:
MultiplicativeOrder[10, 998001]
2997