# How to deal with multiple conflicting possibilities when using collect

I have some equations that I would like to group according to specified terms.

For example, $$x_1x_2x_3+x_1x_2x_4+x_1x_5x_6+3x_1x_2x_3$$.

I would like this to be grouped as $$3x_1x_2x_3+x_1x_2x_4+x_1x_5x_6$$.

However, when using Collect in Mathematica, it is grouping them as $$x_1(3x_2x_3+x_2x_4+x_5x_6)$$.

I am currently specifying all possible combinations $$x_i, x_ix_j$$ and $$x_ix_jx_k$$ as the terms I would like to group by. Selecting just the third order terms isn't an option here for what I need to use it for.

Is there anyway to stop it factorising the expressions?

• It is not clear, what do you want to achieve. In particular, the term 3x1x2x3+x1x2x4+x1x5x6 is only a part of the starting expression, and the words "I would like this to be grouped as..." are unclear. I suggest that you take a minimal expression and show both its initial and its final forms. It would be also a good idea if you explain the reason for this operation. For example, if it is an intermediate calculation step, it is one thing. If it is a final representation of your result - the other. Besides, please write all the expressions in Mathematical notations in acopy-paste ready form. May 6, 2021 at 12:24
• The out put of your expression in MMA version 12.1 is : 4 x1 x2 x3 + x1 x2 x4 + x1 x5 x6 May 6, 2021 at 12:53