Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/sage/arith/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2775,9 +2775,7 @@ def radical(n, *args, **kwds):
sage: radical(2 * 3^2 * 5^5)
30
sage: radical(0)
Traceback (most recent call last):
...
ArithmeticError: radical of 0 is not defined
0
sage: K.<i> = QuadraticField(-1) # needs sage.rings.number_field
sage: radical(K(2)) # needs sage.rings.number_field
i - 1
Expand Down
4 changes: 1 addition & 3 deletions src/sage/categories/unique_factorization_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ def radical(self, *args, **kwds):
sage: Integer(-100).radical()
10
sage: Integer(0).radical()
Traceback (most recent call last):
...
ArithmeticError: radical of 0 is not defined
0

The next example shows how to compute the radical of a number,
assuming no prime > 100000 has exponent > 1 in the factorization::
Expand Down
19 changes: 19 additions & 0 deletions src/sage/rings/integer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5911,6 +5911,25 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
flag = self < 0 and proof
return objtogen(self).qfbclassno(flag).sage()

def radical(self, *args, **kwds):
"""
Return the radical of this integer, i.e., the product of its
prime divisors.

EXAMPLES::

sage: 0.radical()
0
sage: 10.radical()
10
sage: (-12).radical()
6
"""
if self.is_zero():
return self

return self.factor(*args, **kwds).radical_value()

def squarefree_part(self, long bound=-1):
r"""
Return the square free part of `x` (=``self``), i.e., the unique integer
Expand Down
Loading