How can I match irreducible fractions with regex?
For example, 23/25, 3/4, 5/2, 100/101, etc.
First of all, I have no idea about the gcd-algorithm realization in
If you write the numbers in unary, and use ":" as the division sign, I think this matches reducible fractions:
/^1+:1$|^(11+):\1$|^(11+?)\2+:\2\2+$/
You can then use !~ to find strings that don't match.
Based on this: http://montreal.pm.org/tech/neil_kandalgaonkar.shtml