Well to make my solution a little less "brute" and a bit more smart, only check the combinations where the sum of all digits is equal to 45, which is the sum of the digits one to nine.
This should save some time.
I really wonder if using a permutation engine would be that much faster as it takes time to generate the 10! combinations as well.
In any case my proposed solution woudl work equally well (and probably even better) with the generated list of allowable permutations.
I have a feeling that hardcoding the problem into a PERL script with all constraints will take much longer. At least my solution is more general.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
In reply to Re: Re: Re: Words that equal numbers
by CountZero
in thread Words that equal numbers
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |