Skip to content

Commit a6770f8

Browse files
committed
pass extra arguments on to Integer.factor()
1 parent 0f06092 commit a6770f8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/sage/rings/integer.pyx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,14 +2951,19 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
29512951

29522952
return n
29532953

2954-
def prime_divisors(self, *, limit=None):
2954+
def prime_divisors(self, *args, **kwds):
29552955
"""
29562956
Return the prime divisors of this integer, sorted in increasing order.
29572957
29582958
If this integer is negative, we do *not* include -1 among
29592959
its prime divisors, since -1 is not a prime number.
29602960
2961-
If ``limit`` is given, only primes up to the limit are returned.
2961+
INPUT:
2962+
2963+
- ``limit`` -- (integer, optional keyword argument)
2964+
Return only prime divisors up to this bound.
2965+
2966+
Any additional arguments are passed on to the :meth:`factor` method.
29622967
29632968
EXAMPLES::
29642969
@@ -2971,7 +2976,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
29712976
sage: a = 2004; a.prime_divisors()
29722977
[2, 3, 167]
29732978
2974-
::
2979+
Setting the optional ``limit`` argument works as expected::
29752980
29762981
sage: a = 10^100 + 1
29772982
sage: a.prime_divisors()
@@ -2982,7 +2987,8 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
29822987
sage: a.prime_divisors(limit=10^7)
29832988
[73, 137, 401, 1201, 1601, 1676321]
29842989
"""
2985-
res = [r[0] for r in self.factor(limit=limit)]
2990+
res = [r[0] for r in self.factor(*args, **kwds)]
2991+
limit = kwds.get('limit')
29862992
if limit is not None:
29872993
res = [r for r in res if r <= limit]
29882994
return res

0 commit comments

Comments
 (0)