Notice that the repeating decimal Thus In general, an n-parasitic number can be found as follows.
For another example, if n = 2, then 10n − 1 = 19 and the repeating decimal for 1/19 is So that for 2/19 is double that: The length m of this period is 18, the same as the order of 10 modulo 19, so 2 × (1018 − 1)/19 = 105263157894736842.
The step-by-step derivation algorithm depicted above is a great core technique but will not find all n-parasitic numbers.
The algorithm begins building from right to left until it reaches step 15—then the infinite loop occurs.
The fix, when this condition is identified and the n-parasitic number has not been found, is simply to not shift the product from the multiplication, but use it as is, and append n (in this case 5) to the end.
When the shift number is created it may contain a leading zero which is positionally important and must be carried into and through the next step.
The resulting Shift is fed into Step 6 which displays a product proving the 4-parasitic number ending in 4 is 102564.
In duodecimal system, the smallest n-parasitic numbers are: (using inverted two and three for ten and eleven, respectively) (leading zeros are not allowed) In strict definition, least number m beginning with 1 such that the quotient m/n is obtained merely by shifting the leftmost digit 1 of m to the right end are They are the period of n/(10n − 1), also the period of the decadic integer -n/(10n − 1).