Permutations of a sequence - variation 2
- To: mathgroup at smc.vnet.net
- Subject: [mg76175] Permutations of a sequence - variation 2
- From: Virgil Stokes <vs at it.uu.se>
- Date: Thu, 17 May 2007 06:01:16 -0400 (EDT)
Suppose I have a sequence: {1,2,3,4,5} and I would like to generate all permutations of this sequence with the constraint that the last element not be the same as the first. Thus, {2,5,3,1,4} is acceptable; but, {2,5,3,4,1} is not. Are there Mathematica commands that allow this to be done efficiently for a sequence {1,2,...,n}? Note, the solution of this problem can be used to solve the earlier problem that I posted on sequence permutations. --V. Stokes