Arrange the table cells according to the number of elements in the cell and add a column containing the number of elements in each cell.
If I have the lists
S1 = {Subscript[x, 1] Subscript[x, 2] , Subscript[x, 3] };
S2 = {Subscript[x, 4] Subscript[x, 5],
Subscript[x, 6] Subscript[x, 7] Subscript[x, 8]};
I use this code to create a table
TableForm[
ToExpression /@ (StringRiffle[#, {"{", "", "}"}] & /@
Tuples[{S1, S2}]), TableHeadings -> Automatic]
The output is in the form:
I need to sort the table cells according to the number of items in the cell in ascending order.
Then add a column containing the number of elements in each cell. The output will be in the form
Thanks for the help.