0
$\begingroup$

How do we create a list pair from the below list

list1={11,12,13,14,15,16};

desired pair list

listpair={{11,11},{11,12},{11,13},...,{11,16},{12,12},{12,13},...,{12,16},{13,13},{13,14},...,{13,16},...,{16,16}}
$\endgroup$
  • $\begingroup$ Have you seen Subsets[] or Tuples[]? $\endgroup$ – J. M.'s technical difficulties Mar 27 '18 at 13:14
  • $\begingroup$ I have seen Tuples although I could not use it I suspected my choice. Once again I will try. $\endgroup$ – monfneg Mar 27 '18 at 13:21
  • $\begingroup$ Tuples generates some unwanted terms such as {12,11}. $\endgroup$ – monfneg Mar 27 '18 at 13:25
  • $\begingroup$ Subsets does not generate {12,12} or {13,13} $\endgroup$ – monfneg Mar 27 '18 at 13:25
2
$\begingroup$
Select[Tuples[list1, 2], #[[1]] <= #[[2]] &];

How about this?

| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.