Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( #3333=superdoc: 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 non-trivial 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 4-digit 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 reply to Re^2: Coming soon: Algorithm::Loops (restrictions) by tye
in thread Coming soon: Algorithm::Loops by tye

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (2)
    As of 2021-04-12 03:47 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?