Python | sympy.core() method

With the help of sympy.core() method, we can calculate the of a positive integer n. core(n, t) calculates the t-th power free part of n.
If n’s prime factorization is :
then
Syntax: core(n, t=2)
Parameter:
n – It denotes an integer.
t – It denotes an integer(optional). Default for t is 2.Returns: Returns the t-th power free part of n.
Example #1:
# import core() method from sympy from sympy.ntheory.factor_ import core n = 24k = 2 # Use core() method core_n_k = core(n, k) print("core({}, {}) = {} ".format(n, k, core_n_k)) |
Output:
core(24, 2) = 6
Example #2:
# import core() method from sympy from sympy.ntheory.factor_ import core n = 11**4k = 3 # Use core() method core_n_k = core(n, k) print("core({}, {}) = {} ".format(n, k, core_n_k)) |
Output:
core(14641, 3) = 11


