CombinatorialCase000/100
From NARS2000
Jump to navigationJump to searchM Pigeons into N holes
Cases 000 and 100 are both trivial.
 M unlabeled (0) or labeled (1) balls into N unlabeled boxes (0), at most one per box (0)
 Not ⎕IOsensitive
 Counted result is a Boolean scalar
 Generated result is a Boolean matrix.
The count for this function is M≤N.
If M>N, then there is no answer, or more accurately, the result is an empty matrix of shape 0 N. If M≤N, then the result is a onerow matrix with M leading 1s and the rest 0s. Combining these two cases yields a result of ((M≤N) N)⍴N↑M⍴1.
For example:
If we have 3 unlabeled balls (●●●) and 5 unlabeled boxes with at most one ball per box, there is only 1 (↔ 3≤5) way to meet these criteria:





as well as





The diagram above corresponds to
000 1‼3 5 1 1 1 0 0 ⍝ M pigeons into N holes ⍝ Unlabeled balls & boxes, ≤1 # Balls per Box 000 1‼4 5 1 1 1 1 0