# Anomalous Cancellation definition

Quoting mathworld:

Anomalous cancellation is a "canceling" of digits of $a$ and $b$ in the numerator and denominator of a fraction $a/b$ which results in a fraction equal to the original. Note that if there are multiple but differing counts of one or more digits in the numerator and denominator there is ambiguity about which digits to cancel, so it is simplest to exclude such cases from consideration.

Some examples, here are all the 2 digit fractions that cancel:

$$\require{cancel} \frac{16}{64} = \frac{1 \cancel{6}}{\cancel{6}4} = \frac{1}{4} \\ \frac{19}{95} = \frac{1}{5} \\ \frac{26}{65} = \frac{2}{5} \\ \frac{49}{98} = \frac{4}{8}$$

I wrote a simple program to iterate over values and check for anomalous cancellation. Mathworld says

The numbers of anomalously cancelling proper fractions having $n$ digits in both numerator and denominator for $n$=1, 2, ... are 0, 4, 161, 1851, ....

However, for $n$=3, I'm coming up with 157 results. My first few values are:

Cancel 6: 106 / 265 == 10 / 25
Cancel 6: 116 / 464 == 11 / 44
Cancel 9: 119 / 595 == 11 / 55
Cancel 3: 132 / 231 == 12 / 21
Cancel 3: 134 / 536 == 14 / 56
Cancel 3: 134 / 737 == 14 / 77
Cancel 3: 134 / 938 == 14 / 98
Cancel 3: 136 / 238 == 16 / 28


I am not considering a factor of $0$, or allowing a factor $x \cong 0 \mod 10$ or allowing any numerator or denominator divisible by 10. I am not considering a single factor that occurs more than once. I am considering any proper substring for my factors, for example, a four digit number would consider any one, two, and three digit factors that appear as substrings. (Edit: this was not considering disjoint combinations of factors, nor was it considering two or more digit combination of factors; see update below).

Likewise, for $n$ or fewer digits, mathworld gives a count of 190 while I'm coming up with 180.

It seems the definition from mathworld is incomplete, so my question is:

What definition should be used that will result in the counts given on the mathworld page?

update

Mathworld lists $\frac{1016}{4064} = \frac{101}{404}$ so it appears that uncancelled digits ($0$ in this case) are allowed.

Mathworld also lists $\frac{1019}{5095} = \frac{11}{55}$ so it appears that disjoint combinations are allowed.

$\frac{499}{998} = \frac{49}{98} = \frac{4}{8}$ Should this be counted once or twice? Note: there are 4 such three digit fractions.

Mathworld says that if there are multiple but differing counts of a digit the fraction should be ignored. That seems reasonable, but is perhaps more restrictive than it needs to be because there are unambiguous counter examples such as $\frac{796}{995} = \frac{76}{95}$

I'm pulling out combinations of consecutive digits of a number to consider as factors. For example, given $123$, I will consider $\{3\}, \{2\}, \{23\}, \{1\}, \{1,3\}, \{12\}$. I'm still not allowing any factor $x \cong 0 \mod 10$. Additionally, because this is supposed to be anomalous, I am not allowing any factor that divides the numerator or denominator outright. This gets me 134 unique three digit fractions, 27 short of 161. Allowing factors that do divide the numerator or denominator gives 183 unique three digit fractions.

Given their first entries, Mathworld must be excluding those where the deleted digits are a bunch of $0$'s in the middle.

... which makes sense: the fact that $\frac{101}{202}=\frac{11}{22}$ isn't really 'anomalous' if you think about it.

Indeed, in general: if using decimal representation: $$a=a_1a_2a_3...a_i0^ka_{i+1}...a_n$$ and $$b=b_1b_2b_3...b_i0^kb_{i+1}...b_n$$ then if

$$\frac{a_1a_2a_3...a_i}{b_1b_2b_3...b_i}=\frac{a_{i+1}...a_n}{b_{i+1}...b_n}$$

then of course:

$$\frac{a_1a_2a_3...a_i0^ka_{i+1}...a_n}{b_1b_2b_3...b_i0^kb_{i+1}...b_n}=\frac{a_1a_2a_3...a_ia_{i+1}...a_n}{b_1b_2b_3...b_ib_{i+1}...b_n}$$

So these kinds of cases are just as 'trivial' (and hence not 'anomalous') as having a bunch of trailing $0$'s.

Now, I note that there are $36$ cases for $n=3$ where $a=k0k$ and $b=m0m$ with $k<m$: $8$ cases where $a=101$ ($b=202$, $303$, $404$, ...), $7$ cases where $a=202$ ($b=303$, $404$, ...), etc. So that could be the difference between your $197$ and Mathworld's $161$ ...

Except that you have other cases yet, e.g you have $a=103$ and $b=206$, etc. So, if this was the difference, the difference between what you got and what Mathworld got should have been more than $36$ ...

Are you sure your program is correct? Why, for example, is $a=102$ and $b=204$ not on your list? Or at least not in the beginning of your list as shown? If it is ordered by $b$, it should have been the second entry ...

Also, I am wondering if your computer program is able to recognize the equality of certain ratios, especially if they have infinite decimal expansions .. though I see it does recognize equalities like $\frac{154}{253}=\frac{14}{23}$ ...

• hmm, I think that's more than 36 though, because there are for instance $\frac{206}{103}$ and $\frac{208}{104}$ – Burnsba Nov 9 '17 at 15:49
• @Burnsba Oh, yes, you're right! so if that was it, you should have gotten even more! Hmmm, you have to agree though that it would make sense to not count those where the $0$'s in the middle make no difference just as much trailing $0$'s make no difference (and clearly those trailing $0$ ones aren't being counted, neither by you or Mathworld). For example, given that $7 \cdot 1 =7$ and $7 \cdot 13 =91$, of course we would have that $\frac{1013}{7091}=\frac{113}{791}$. So I still think that the discrepancy has to do with something like that. – Bram28 Nov 9 '17 at 16:04
• @Burnsba I just noticed that $\frac{204}{102}$ is not in the first entries of your list. Is it on there at all? – Bram28 Nov 9 '17 at 18:00
• Yeah, I'm not entire sure my program is correct. For one, I just realized it's not considering two digit "factors" to cancel. But I have a comparison for before and after factoring that avoids division: $N \times D' == N' \times D$ for N,D = numerator and denominator – Burnsba Nov 9 '17 at 18:35
• @Burnsba Ah, that comparison is smart! :) OK, so that's not it. – Bram28 Nov 9 '17 at 18:36