Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Seeking an efficient filter for partitions.

From the docs:

sage: Partitions(4, max_part=2).list()
[[2, 2], [2, 1, 1], [1, 1, 1, 1]]

I find this parlance confusing. Obviously the the partition [1, 1, 1, 1] has no max part = 2. Be that as it may, I do want to filter those partitions which greatest part is 2, so in the example would return

[[2, 2], [2, 1, 1]].

What is the most efficient way to implement

P(n,k) = Partitions(n, MAX_PART=k)

where MAX_PART is defined in my sense?

Seeking an efficient filter for partitions.

From the docs:

sage: Partitions(4, max_part=2).list()
[[2, 2], [2, 1, 1], [1, 1, 1, 1]]

I find this parlance confusing. Obviously the Obviously the partition [1, 1, 1, 1] has no max part = 2. Be that as it may, I do want to filter those partitions which greatest part is 2, so in the example would return

[[2, 2], [2, 1, 1]].

What is the most efficient way to implement

P(n,k) = Partitions(n, MAX_PART=k)

where MAX_PART is defined in my sense?