Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: How to restrict partitions

by AnomalousMonk (Archbishop)
on Jan 18, 2014 at 17:10 UTC ( [id://1071120]=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to restrict partitions
in thread How to restrict partitions

Or, if all the values of the partitions must be unique, maybe something like (untested):

use Integer::Partition qw(); use List::MoreUtils qw(uniq); my $i = Integer::Partition->new(6); my $n = 5; while (my $p = $i->next()) { do_whatever_with($p) if (@$p == $n) and (@$p == uniq @$p); }

Replies are listed 'Best First'.
Re^5: How to restrict partitions
by crunch_this! (Acolyte) on Jan 19, 2014 at 03:11 UTC
    That MoreUtils module seems to be really handy, but I tried some bigger numbers & I might have to rethink the overall approach. Thx for the help though everybody.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1071120]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2025-07-11 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.