How does the sympy factorization of python get the second factor?

import sympy
x=sympy.symbols("x")
r=sympy.factor(x**7-1)
print(sympy.factor(x**7-1))
(x - 1)*(x**6 + x**5 + x**4 + x**3 + x**2 + x + 1)

how can I get the second expression (x words 6 + x words 5 + x words 4 + x words 3 + x words 2 + x + 1) before I operate? Thank you

May.27,2022

use factor_list , you can do this:

x = sympy.symbols('x')
r = sympy.symbols(x**7 - 1)
s = r / (x - 1)
print(s)
-sharp x**6 + x**5 + x**4 + x**3 + x**2 + x + 1
Menu