Skip to content

Commit 4ec3ad4

Browse files
committed
Add flag for ending size and simplify size check
1 parent 8841d00 commit 4ec3ad4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sage/combinat/partition.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7522,7 +7522,7 @@ def first(self):
75227522
sage: Partitions(3, starting=[2,2]).first()
75237523
[2, 1]
75247524
"""
7525-
if self._starting in Partitions_n(self.n):
7525+
if sum(self._starting) == self.n:
75267526
return self._starting
75277527

75287528
if (k := self._starting.size()) < self.n:
@@ -7588,6 +7588,7 @@ def __init__(self, n, ending_partition):
75887588
Partitions.__init__(self)
75897589
self.n = n
75907590
self._ending = ending_partition
7591+
self._ending_size_is_not_same = (n != sum(self._ending))
75917592

75927593
def _repr_(self):
75937594
"""
@@ -7653,7 +7654,7 @@ def next(self, part):
76537654

76547655
# if self._ending is a different size, we should make the comparison
76557656
mu = next(part)
7656-
if mu < self._ending:
7657+
if self._ending_size_is_not_same and mu < self._ending:
76577658
return None
76587659
return mu
76597660

0 commit comments

Comments
 (0)