Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
1. how can i work with (much) more that 32 1's+0's ?

You almost certainly do not need to. It could be extended to handle 53-bits quite easily, but given that it would take the fastest algorithm in this thread ~462 years to deal with the numbers possible from that small number of bits. And as your target of 435 + 343 will take, for all intents and purposes, that number * infinity--so many times longer than the universe has existed as to be totally meaningless--you simply don't.

One has to wonder what use, other than as another outing for Algorithm::Loops, that you thought you were going to put this to?

Had you been dealing with reasonable numbers, I've got a specialisation of tye's nextPermute() that handles this particular problem about 3 1/2 times more quickly, but unless your name is Q, it probably won't help :)

Update: Seems someone didn't bellieve me:

sub combs2 { my( $z, $o ) = @_; my $str = '0'x$z . '1'x$o; my $l = length $str; return sub { my $p = 1+rindex( $str, '01' ) or return; my $r = 1+rindex( $str, '1'); my $s = 1+rindex( $str, '0', $r-1); substr( $str, $s, 0 ) = substr( $str, $r, $l-$r, '' ); my $q = index( $str, '1', $p ); substr( $str, $p-1, 1 ) = '1'; substr( $str, $q, 1 ) = '0'; $str; }; }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^5: One Zero variants_without_repetition by BrowserUk
in thread One Zero variants_without_repetition by thenetfreaker

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (None)
    As of 2024-04-25 04:25 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found