Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: (Golf as well): List of Partitions

by Masem (Monsignor)
on May 06, 2001 at 16:54 UTC ( #78346=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub P {
    $_[0]?map{my$c=$_;map[$c,@$_],P($_[0]-$c)}(1..$_[0]):[]
    }
    
  2. or download this
    sub P {
    my$b=$_[1]||$_[0];
    $_[0]?map{my$c=$_;map[$c,@$_],P($_[0]-$c,$c)}grep{$_<=$b}(1..$_[0]):[]
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (21)
As of 2014-08-27 16:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (244 votes), past polls