Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a simple question coincerning the Mathematica function Tuple.

Currently, I apply the following code

x = {1, 2, 3};
Tuples[x, 2]

Obviously I get:

enter image description here

How can I delete all self-loops from this list, i.e., delete {1, 1}, {2, 2}, {3, 3}? Is there a built-in function?

share|improve this question

1 Answer 1

up vote 11 down vote accepted

I think you want Permutations:

Permutations[{1, 2, 3}, {2}]

{{1, 2}, {1, 3}, {2, 1}, {2, 3}, {3, 1}, {3, 2}}

share|improve this answer
    
perfect. Thanks a lot –  Julian Aug 27 at 7:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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