CombinatorialCase002: Difference between revisions
From NARS2000
Jump to navigationJump to search
mNo edit summary |
No edit summary |
||
| Line 6: | Line 6: | ||
* Generated result is an integer matrix. | * Generated result is an integer matrix. | ||
The count for this function is <apll>M PN N</apll> where <apll>M PN N</apll> calculates the number of [https://en.wikipedia.org/wiki/Partition_(number_theory) Partitions] of the number <apll>M</apll> into exactly <apll>N</apll> parts. | The count for this function is <apll>M PN N</apll> where <apll>M PN N</apll> calculates the number of [https://en.wikipedia.org/wiki/Partition_(number_theory)#Restricted_part_size_or_number_of_parts Partitions] of the number <apll>M</apll> into exactly <apll>N</apll> parts. | ||
For example: | For example: | ||
Latest revision as of 18:50, 19 June 2017
This case produces the Partitions of the number M into exactly N parts.
- M unlabeled balls (0), N unlabeled boxes (0), at least one ball per box (2)
- Not ⎕IO-sensitive
- Counted result is an integer scalar
- Generated result is an integer matrix.
The count for this function is M PN N where M PN N calculates the number of Partitions of the number M into exactly N parts.
For example:
If we have 8 unlabeled balls (●●●●●●●●) and 3 unlabeled boxes with at least one ball per box, there are 5 (↔ 8 PN 3) ways to meet these criteria:
|
|
|
|
|
The diagram above corresponds to
002 1‼8 3
6 1 1
5 2 1
4 3 1
4 2 2
3 3 2
⍝ Partitions of M into N parts
⍝ Unlabeled balls & boxes, ≥1 # Balls per Box
002 1‼5 5
1 1 1 1 1
002 1‼5 4
2 1 1 1
002 1‼5 3
3 1 1
2 2 1
002 1‼5 2
4 1
3 2
002 1‼5 1
5
Identities
Because partitions of M into N non-negative parts (001) is the same as partitions of M+N into N positive parts (002), these cases are related by the following identity (after sorting the rows):
002 1‼M N ↔ ⊃1+R↑¨001 1‼(0⌈M-N) N