I came across something I find interesting while researching fun little mathematical topics. I came across a video called "The Wrong Way To Reduce Fractions. But It Works Sometimes."
https://youtube.com/watch?v=fQl040dANZw
From looking this up, I realized it has a name: anomalous cancellation. I decided to make a program to detect and generate these fractions.
For purposes of the program, a fraction is anomalously cancellable if it evaluates to a number less than 1, and it results in an equal fraction if you remove all like digits from the numerator and denominator. Leading zeroes are not allowed, nor are trailing zeroes if they cancel with other trailing zeroes.
As one example, 163/326 is anomalously cancellable, because if you "cancel" the 6s and 3s, you end up with 1/2, which is indeed equal to 163/326.
I have a rudimentary program in CE BASIC to detect these kinds of fractions (CE because I used toString() for many things), and a similar one to "generate" by checking every rational number (up to a point) and seeing if they fit this definition. I'm sure there are faster and better ways to do it, though.
Before I start speeding up my program (partly because I now have no way of uploading my program until I get a new computer), I wanna see how you would tackle this, checking if some fraction is anomalously cancellable. I also wonder if, through some math, someone could somehow find out some properties of these fractions so I can avoid checking some rational numbers.
https://youtube.com/watch?v=fQl040dANZw
From looking this up, I realized it has a name: anomalous cancellation. I decided to make a program to detect and generate these fractions.
For purposes of the program, a fraction is anomalously cancellable if it evaluates to a number less than 1, and it results in an equal fraction if you remove all like digits from the numerator and denominator. Leading zeroes are not allowed, nor are trailing zeroes if they cancel with other trailing zeroes.
As one example, 163/326 is anomalously cancellable, because if you "cancel" the 6s and 3s, you end up with 1/2, which is indeed equal to 163/326.
I have a rudimentary program in CE BASIC to detect these kinds of fractions (CE because I used toString() for many things), and a similar one to "generate" by checking every rational number (up to a point) and seeing if they fit this definition. I'm sure there are faster and better ways to do it, though.
Before I start speeding up my program (partly because I now have no way of uploading my program until I get a new computer), I wanna see how you would tackle this, checking if some fraction is anomalously cancellable. I also wonder if, through some math, someone could somehow find out some properties of these fractions so I can avoid checking some rational numbers.