I think that’s very cool. It raises a couple of questions, though:

1) In all the years you and I have been doing professional software development, have either of us ever needed to find the lowest common denominator or the greatest common factor (heck, even the prime factors) of a pair of numbers? I haven’t. So why does that admittedly cool function exist?

2) You’ve reminded me of the caution of evolutionary programming: your algorithm will optimize for the fitness criteria, so be careful how you express those criteria. What’s the point of the homework? Does the teacher have a burning desire to know the sum of 5/6 and 7/15? Clearly, it’s not really a quest for arithmetic answers. What is it a quest for? Probably, it’s an exercise in repetition because human brains don’t really learn things until they’ve been repeated several times. And since it’s not the same problem over and over, it’s not an exercise in memorizing the LCM of 6 and 15. It’s probably an exercise in memorizing the techniques of manipulating fractions. Why would we need to do that, since there’s this swell LCM function? I dunno, maybe to get the kid ready to work on algebraic expressions that involve fractions without freaking out.

3) Why didn’t you do it in BASIC?