Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: Delete all the memory except 1 matrix
  • Next by Date: All permutations of a sequence
  • Previous by thread: Re: Delete all the memory except 1 matrix
  • Next by thread: Re: Permutations of a sequence - variation 2