How NOT to reduce fractions Reducing fractions the wrong way
In this code-golf challenge you have to find fractions that can be reduced the wrong way but still end up in the same number.
Note: reducing fractions the wrong way does here have an exact definition, see details.
Example:
64/16 = 64/16=4/1 = 4
Of course you cannot just strike both 6es but here you still end up with the correct value. In this challenge you have to find examples like this.
Details
You have to write a function/program that accepts one positive integer n as input and outputs/returns a list/array of the fractions in format
numerator1,denominator1,numerator2,denominator2,...
The program has to find out for each fraction a/b with a+b=n and a,b&gt;0 whether it can be reduced the wrong way. (It does not matter whether if it can be reduced in the conventional way or whether there are many possibilities of reductions, it just has to be possible to reduce it the wrong way in at least one way.)
Definition of the wrong way: A fraction can be reduced the wrong way if and only if the same sequence of successive digits appears in a and b and if the value of the fraction stays the same if you remove the substring.
Example: 1536/353 can be 'reduced' to 16/3 but those two values are not equal so you cannot reduce this fraction the wrong way.
Note that this definition of reducing the wrong way can also include fractions that are reduced the right way: 110/10 = 11/1 is within the definition of reducing the wrong way even though it is a valid step.
Scoring
The least number of bytes wins. You can write a function or program that accepts an integer and returns an array or a program that uses stdin/stdout or you can consider n saved in a variable and in the end of the program the list must be saved in an other variable.
Test cases
Please include following testcases (Tell me which ones I should add, I have no idea how many of those fractions there are / how many examples to expect)
n=80 (64/16 should be in this list)
n=147 (98/49 should be in this list)
n=500 (294/196 should be in this list) WRONG since 294+196 != 500 Thanks Falko
Haskell, 207 206 (209?) characters

import Data.List
x![]=[x];(w:x)!(y:z)|w==y=x!z;_!_=[]
a@(w:x)%b=a!b++[w:e|e&lt;-x%b];a%b=a!b
h=show
f n=[(c,n-c)|c&lt;-[1..n-1],i&lt;-inits$h c,s&lt;-init$tails i,s/=h c,a&lt;-h c%s,b&lt;-h(n-c)%s,read a*(n-c)==read('0':b)*c]

If it's not allowable to return the same ratio more than once (400/400 = 40/40 = 4/4), use f n=nub[... to filter them out.
Returns a list of pairs. A list of two-element pairs costs the same. A list of actual fractions would require importing Data.Ratio or fully qualifying Data.Ratio.% (which also collides with the % function defined here)
test cases (with nub):
Prelude Data.List&gt; f 80
[(10,70),(16,64),(20,60),(30,50),(40,40),(50,30),(60,20),(64,16),(70,10)]
Prelude Data.List&gt; f 147
[(49,98),(98,49)]
Prelude Data.List&gt; f 500
[(10,490),(20,480),(30,470),(40,460),(50,450),(60,440),(70,430),(80,420),(90,410
),(100,400),(110,390),(120,380),(130,370),(140,360),(150,350),(160,340),(170,330
),(180,320),(190,310),(200,300),(210,290),(220,280),(230,270),(240,260),(250,250
),(260,240),(270,230),(280,220),(290,210),(300,200),(310,190),(320,180),(330,170
),(340,160),(350,150),(360,140),(370,130),(380,120),(390,110),(400,100),(410,90)
,(420,80),(430,70),(440,60),(450,50),(460,40),(470,30),(480,20),(490,10)]

ungolfed and commented:
import Data.List

-- haystack ! needle - the haystack with the needle removed, wrapped in a single-element list
--                       or an empty array if the haystack does not start with the needle

x ! [] = [x]                        -- case: empty needle = match with the full haystack left
(h:hs) ! (n:ns) | h == n = hs ! ns  -- case: needle and haystack match
_ ! _ = []                          -- case: no match

-- haystack % needle - the haystack with the needle removed 
--                       for all positions of the needle in the haystack

a@(h:hs) % b = a ! b ++ map (h:) (hs%b) -- either remove the needle here, or elsewhere
a % b = a                               -- empty haystack cannot be popped

-- f - the function we are interested in

f total = [ (num, total - num) 
          | num   &lt;- [1 .. total-1],            -- for each numerator in range
            i     &lt;- inits $ show num,          -- for each postfix of the numerator
            sub   &lt;- init $ tails i,            -- for each prefix of the postfix except the last (empty) one
            sub /= show num,                    -- that isn't equal to the numerator
            reNum &lt;- show num % sub,            -- remove the substring from the numerator
            reDiv &lt;- show (total - num) % sub,  -- as well as from the denominator.

                                                -- the resulting ratios must be equal by value:
            (read reNum) ^ (total - num) == (read '0':reDiv) * num]