Skip to main content
added 107 characters in body
Source Link
eldo
  • 83.1k
  • 6
  • 72
  • 202

A variant of E. Chan-López answer

pol = p[1, 2, 5] p[3, 6, 9] p[4, 7, 8] - 3 p[1, 2, 4] p[3, 6, 9] p[5, 7, 8];

ReplaceAll[p :> List] @ Query[All, All, 1][FactorList /@ List @@ pol]

{{1, {1, 2, 5}, {3, 6, 9}, {4, 7, 8}}, {-3, {1, 2, 4}, {3, 6, 9}, {5, 7 7, 8}}}

Or, as Roman commented:

(FactorList /@ List @@ pol)[[All, All, 1]] /. p -> List

same result

A variant of E. Chan-López answer

pol = p[1, 2, 5] p[3, 6, 9] p[4, 7, 8] - 3 p[1, 2, 4] p[3, 6, 9] p[5, 7, 8];

ReplaceAll[p :> List] @ Query[All, All, 1][FactorList /@ List @@ pol]

{{1, {1, 2, 5}, {3, 6, 9}, {4, 7, 8}}, {-3, {1, 2, 4}, {3, 6, 9}, {5, 7, 8}}}

A variant of E. Chan-López answer

pol = p[1, 2, 5] p[3, 6, 9] p[4, 7, 8] - 3 p[1, 2, 4] p[3, 6, 9] p[5, 7, 8];

ReplaceAll[p :> List] @ Query[All, All, 1][FactorList /@ List @@ pol]

{{1, {1, 2, 5}, {3, 6, 9}, {4, 7, 8}}, {-3, {1, 2, 4}, {3, 6, 9}, {5, 7, 8}}}

Or, as Roman commented:

(FactorList /@ List @@ pol)[[All, All, 1]] /. p -> List

same result

Source Link
eldo
  • 83.1k
  • 6
  • 72
  • 202

A variant of E. Chan-López answer

pol = p[1, 2, 5] p[3, 6, 9] p[4, 7, 8] - 3 p[1, 2, 4] p[3, 6, 9] p[5, 7, 8];

ReplaceAll[p :> List] @ Query[All, All, 1][FactorList /@ List @@ pol]

{{1, {1, 2, 5}, {3, 6, 9}, {4, 7, 8}}, {-3, {1, 2, 4}, {3, 6, 9}, {5, 7, 8}}}