Just another Perl shrine  
PerlMonks 
Re^2: Coming soon: Algorithm::Loops (restrictions)by tye (Sage) 
on Apr 12, 2003 at 07:27 UTC ( #250035=note: print w/replies, xml )  Need Help?? 
I believe the original question doesn't put any limit on number of digits in the numbers I mostly didn't assume any restrictions on the number of digits in the numbers being added. I derived the restrictions from my desire to have unique numbers and a nontrivial answer. If I picked two digits, then I'd only have two numbers to add up (XY and YX) and so I can't get a sum of even 200. If I picked four digits, then the number of combinations to search is quite small and might be a fun challange with paper and pencil but didn't seem interesting from the angle I was tackling things. Since I started out wanting to avoid leading zeros, the space to search would be so small that even with pencil and paper it wouldn't be very interesting. (: But with a quick change of a couple of characters, I see that adding up two 4digit numbers (having the same digits in different orders) never gives us 2003. But of course it can't, because all such would be even modulo 9 while 2003 is odd modulo 9. Thanks for the vote in favor of Algo.::Loops. BTW, I have a much faster version of my code searching for optimal stamp denominations. Still not nearly as fast as I'd like (with one search still going after 120 hours of CPU). I'll post that code when I get some time.  tye
In Section
Cool Uses for Perl

