User:Arthur Rubin/Parasitic number

Working page for possible inclusion in Parasitic number

Direct approach
Using $$\circ$$ for concatentation of digit strings, the definition of Parasitic number reads:
 * $$n \times (y \circ d) = (d \circ y)$$
 * $$x = (y \circ d)\,$$


 * $$y = \frac {x-d} {10} = n x - d 10^{m-1}$$

Multiplying by 10, and separating:
 * $$\left(10^m-1 \right) d = \left(10 n - 1\right) x$$

Or:
 * $$x = d \frac {10^m-1}{10n-1}$$

As $$GCD(10n-1,10)=1$$, there is an m such that this is an integer. (Or, equivalently, $$\frac 1 {10n-1}$$ is a repeating decimal with no initial term, and with period dividing m.)

Generalizations
For a k-digit right shift, the equation becomes:
 * $$n \times (y \circ d) = (d \circ y)$$
 * $$x = (y \circ d)\,$$

(where d is no longer a "digit", but a k-digit number)

Mathematically, that reads:
 * $$y = \frac {x-d} {10^k} = n x - d 10^{m-k}$$

Multiplying by 10k, and separating:
 * $$\left(10^m-1 \right) d = \left(10^k n - 1\right) x$$

Or:
 * $$x = d \frac {10^m-1}{10^kn-1}$$

To avoid leading 0's, $$d \ge 10^{k-1}n$$.

Generalizations
For a k-digit left shift:
 * $$n \times (d \circ y) = (y \circ d)$$
 * $$x = (d \circ y)\,$$

(where d is no longer a "digit", but a k-digit number)


 * $$y = \frac {n x-d} {10^k} = x - d 10^{m-k}$$

Multiplying by 10k, and separating:
 * $$\left(10^m-1 \right) d = \left(10^k - n\right) x$$

Or:
 * $$x = d \frac {10^m-1}{10^k-n}$$

Note also that, regardless of the value of m, $$GCD\left(10^\infty,10^k-n)\right) | d.$$

Here, for the count to be correct, we have the additional condition $$y < 10^{m-k}$$, which corresponds to
 * $$d \frac {n 10^{m-k} - 1} {10^k-n} \le 10^{m-k}-1,$$ or
 * $$ d \le \left (10^{m-k}-1\right) \frac {10^k-n} {n 10^{m-k} -1}$$, from which follows
 * $$ d < \frac {10^k-n} n,$$ or
 * $$ d < \frac {10^k}{n}-1.$$

To avoid leadling 0s, $$d \ge 10^{k-1}.$$

For k=1, this only has non-trivial solutions for:

n = 3, x = 142857 or 285714 (and repeats, of course)