![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Brute force perlby toma (Vicar) |
on Jun 12, 2007 at 17:16 UTC ( #620769=note: print w/replies, xml ) | Need Help?? |
Challenge: generate the numbers 0 to 100 using math expressions composed of only the characters +-/*4() . Find the minimum length expression for each number from 0 to 100. These might be the first few numbers:
The minimum length of these expressions would make an easy fitness function if you wanted to experiment with GA. I originally heard this problem as a math-golf-type challenge to a fifth and sixth grade math club. I don't remember the algorithm that I ended up using, but I do recall writing a generator that created valid expressions, so that the code wouldn't try to eval things like 4-( as an expression.
It should work perfectly the first time! - toma
In Section
Meditations
|
|