Originally Posted by

**Matticus**
It seems to rely more on coincidence (or some obscure mathematical rule that I am unaware of) than mathematical logic

Well, the rule is pretty obscure for sure. If we define

Let

*N* = sum(*N*_{i} ⋅ 10^{i}, *i* = 0..*L*_{N}-1)

where

1 ≤ *N*_{i} ≤ 9, *i* = *L*_{N}-1

0 ≤ *N*_{i} ≤ 9, 0 ≤ *i* < *L*_{N}-1

and

*D* = sum(*D*_{i} ⋅ 10^{i}, *i* = 0..*L*_{D}-1)

where

1 ≤ *D*_{i} ≤ 9, *i* = *L*_{D}-1

0 ≤ *D*_{i} ≤ 9, 0 ≤ *i* < *L*_{D}-1

so that

*N* is an

*L*_{N}-digit positive decimal number,

10^{LN-1} ≤ *N* < 10^{LN}

and

*D* is an

*L*_{D}-digit positive decimal number,

10^{LD-1} ≤ *D* < 10^{LD}

the rule is

There is a pair (

*n*,

*d*),

0 ≤ *n* < *L*_{N}

0 ≤ *d* < *L*_{D}

*N*_{n} = *D*_{d}

that fulfills the following rule:

*U* = sum(*N*_{i} ⋅ 10^{i}, *i* = 0..*n*-1) + sum(*N*_{i} ⋅ 10^{i-1}, *i* = *n*+1..*L*_{N}-1)

*V* = sum(*D*_{i} ⋅ 10^{i}, *i* = 0..*d*-1) + sum(*D*_{i} ⋅ 10^{i-1}, *i* = *d*+1..*L*_{D}-1)

*N* *V* = *D* *U* ≠ 0

I don't think there is a simpler way to state the rule (anything like summing the digits, or such tricks); I think this was what Matticus was saying, too.

The OP's problem to be solved is to find all that fulfill the above, when *L*_{N} = *L*_{D} = 2. My awk scriptlet says there are 242 of those if you count 89/89 = 8/8 and 89/89 = 9/9 as two separate cases, or 170 if you count 89/89 = 8/8 = 9/9 only once.