An interesting problem with fractions

1.2k Views Asked by At

These are a few examples of how "forbidden" procedures can lead us to the correct answer:

$$\displaystyle\frac{1\not4^1}{2\not8_2} = \frac{11}{22}=\frac{1}{2}$$

$$\displaystyle\frac{1\not3^1}{3\not9_3} = \frac{11}{33}=\frac{1}{3}$$

$$\displaystyle\frac{{\not3^1}0}{{\not6_2}0} = \frac{10}{20}=\frac{1}{2}$$

I am interested in the question does there exist a fraction such that it satisfies these $5$ requirements and such that it can be "solved" using this "technique"?

  1. The numerator and denominator have $n$ digits where $5\leq n\leq9$
  2. The number in numerator doesn`t end in $0$.
  3. The number in denominator deosn´t end in $0$.
  4. All digits in number in numerator are different.
  5. All digits in number in denominator are different.

EDIT1: The user found that it is possible for $n=5$, now I have a somewhat different version of the problem with modified first requirement:

1*. The numerator and denominator have $n$ digits where $6\leq n\leq9$

2.,3.,4.,5. Same as above.

I believe that now such fraction doesn`t exist and would be very pleased if someone shows that it is so or finds a counterexample in any of these two cases:

Case A) Only one cancellation is allowed.

Case B) More than one cancellation is allowed.

EDIT2: It seems that belief in non-existence of such fraction in the modified problem $6\leq n\leq9$ was a failure, below you can see that user Ivan Loh found the solution for the cases $n=6,7$ with one cancellation and solution for the case $n=8$ with two cancellations which is indeed more than I was asking, and, following his examples, I found the case for $n=8$ with one cancellation, it is $\displaystyle\frac {21945703}{65837109}=\frac {21945701}{65837103}=\frac {1}{3}$.

4

There are 4 best solutions below

2
On BEST ANSWER

In case you still want a 5 digit example:

$$\frac{14573}{43719}=\frac{14571}{43713}=\frac{1}{3}$$

A 6 digit example:

$$\frac{194573}{583719}=\frac{194571}{583713}=\frac{1}{3}$$

In fact, let's add a $0$, so

$$\frac{1945703}{5837109}=\frac{1945701}{5837103}=\frac{1}{3}$$

If you want more than 1 cancellation, use

$$\frac{19457023}{58371069}=\frac{19457011}{58371033}=\frac{1}{3}$$

2
On

These are known as howlers. Not all fractions obey these laws.

For more info on how to generate them, look at this Dr. Math post.

For the example you need $\frac{31402}{62804}=\frac{1}{2}$.

6
On

5 digit numbers using more than one cancellations:

$$\frac{43201}{86402} = \frac{11101}{22202} = \frac{1}{2}$$

1
On

I wrote some code to generate these kind of fractions. It's written in Python, so it's practically like pseudocode. Basically, I just brute-force over all numbers and simply validate whether it is a Howler fraction or not.

# -*- coding: utf-8 -*-
from fractions import Fraction, gcd

def digitify(x):
    return list(str(x))

def intify(digits):
    return int(float(''.join(map(lambda digit: str(digit), digits))))

def primes(max_ = None, req = None):
    x = 2
    while True:
        composite = None
        for divisor in range(2, x // 2):
            if (x % divisor) == 0:
                composite = True
                break
        if not composite:
            yield x
        x += 1

def factorize(x):
    factors = []
    x = int(x)

    for prime in primes():
        if x == 0 or x == 1:
            break

        if x % prime == 0:
            factors.append(prime)
            while x % prime == 0:
                x /= prime

    return factors

def validate(num, den, strict=False):
    frac = Fraction(num, den)
    num = digitify(num)
    den = digitify(den)

    # cancel last digits
    if (not strict) or (gcd(intify(num[:-1]), intify(den[:-1])) == 1):
        factors = factorize(gcd(int(num[-1]), int(den[-1])))
        for factor in factors:
            num_ = intify(num[:-1] + [int(num[-1]) / factor])
            den_ = intify(den[:-1] + [int(den[-1]) / factor])
            frac_ = Fraction(num_, den_)
            if frac_ == frac:
                return frac_

    # cancel first digits
    if (not strict) or (gcd(intify(num[1:]), intify(den[1:])) == 1):
        factors = factorize(gcd(int(num[0]), int(den[0])))
        for factor in factors:
            num_ = intify([int(num[0]) / factor] + num[1:])
            den_ = intify([int(den[0]) / factor] + den[1:])
            frac_ = Fraction(num_, den_)
            if frac_ == frac:
                return frac_

def find(n):
    start = 10 ** (n-1)
    stop = 10**n + 1

    for x in range(start, stop):
        for y in range(start, stop):
            if x == y:
                continue
            frac = validate(x, y)
            if frac:
                print(x, y, frac)

Executing $find(n)$ provides you with all the Howler fractions of size $n$, though it takes a bit if time to compute them all.

I improvised the algorithm a bit. Now, it takes a fraction finds valid equivalent fractions with the added restriction that the :

def find(frac):
    num = frac.numerator
    den = frac.denominator
    x = 1

    while True:
        x += 1
        num_ = num * x
        den_ = den * x
        frac = validate(num_, den_, strict=True)
        if frac:
            print(num_, den_, frac)

This gives more Howler fractions in significantly less time, although you can't find fractions of length $n$ upfront.

I ran the code on my machine but as soon as I started to paste the output on SE or any pastebin, Chrome froze. But you can run the code on your machine and try (It's Python 3 BTW).

Update: First few fractions of length 5 are here;