CombinatorialCase001

From NARS2000
Revision as of 17:37, 29 April 2017 by WikiSysop (talk | contribs)
Jump to navigationJump to search

This case produces the Partitions of the number L into at most R parts.

  • L unlabeled balls (0), R unlabeled boxes (0), any # of balls per box (1)
  • Not ⎕IO-sensitive
  • Counted result is an integer scalar
  • Generated result is a nested vector of integer vectors.

The count for this function is (L+R)PN R where L PN R calculates the number of Partitions of the number L into exactly R parts.

For example:

If we have 6 unlabeled balls (●●●●●●) and 3 unlabeled boxes with any # of balls per box, there are 7 (↔ (6+3)PN 3) ways to meet these criteria:






       
     
 




 
 
 
 
 
   
     
 
 



 
 
 
 

   
     
 
 



 
 
 
 
 
 
 
 
 
 
     
 
 
 


 
 
 


   
     
 
 
 


 
 
 
 

 
 
 
 
 
     
 
 
 
 

 
 
 
 

 
 
 
 

     

The diagram above corresponds to the nested array

      ⍪001 1‼6 3
 6
 5 1
 4 2
 4 1 1
 3 3
 3 2 1
 2 2 2
      ⍝ Partitions of L into at most R parts
      ⍝ Unlabeled balls & boxes, any #bpb
      ⍪001 1‼5 5
 5
 4 1
 3 2
 3 1 1
 2 2 1
 2 1 1 1
 1 1 1 1 1
      ⍪001 1‼5 4
 5
 4 1
 3 2
 3 1 1
 2 2 1
 2 1 1 1
      ⍪001 1‼5 3
 5
 4 1
 3 2
 3 1 1
 2 2 1
      ⍪001 1‼5 2
 5
 4 1
 3 2
      ⍪001 1‼5 1
 5

Identities

As shown in Wikipedia, (L+R)PN R ↔ +/L PN¨0..R.

Because partitions of L into R non-negative parts (001) is the same as partitions of L+R into R positive parts (002), these cases are related by the following identity:

001 1‼L R ↔ (⊂[⎕IO+1] ¯1+002 1‼(L+R) R)~¨0