MathGroup Archive 2006

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

Search the Archive

Re: General--Simple Permutations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70380] Re: General--Simple Permutations
  • From: dimmechan at yahoo.com
  • Date: Sat, 14 Oct 2006 03:08:58 -0400 (EDT)
  • References: <egn969$1dk$1@smc.vnet.net>

Although I am not sure that I understand what you want,
I will try to make an attempt to answer you.

Here is the list of all possible triplets of elements from {1,2,3,4,5}

lst = Tuples[Range[5], 3];

Length[lst]
125

Here is the list of permutations containing TWO cycles

Cases[lst, Alternatives @@ Permutations[{a_, b_, a_}] /; a != b]
{{1, 1, 2}, {1, 1, 3}, {1, 1, 4}, {1, 1, 5}, {1, 2, 1}, {1, 2, 2}, {1,
3, 1}, {1, 3, 3}, {1, 4, 1}, {1, 4, 4}, {1, 5, 1},
  {1, 5, 5}, {2, 1, 1}, {2, 1, 2}, {2, 2, 1}, {2, 2, 3}, {2, 2, 4}, {2,
2, 5}, {2, 3, 2}, {2, 3, 3}, {2, 4, 2}, {2, 4, 4},
  {2, 5, 2}, {2, 5, 5}, {3, 1, 1}, {3, 1, 3}, {3, 2, 2}, {3, 2, 3}, {3,
3, 1}, {3, 3, 2}, {3, 3, 4}, {3, 3, 5}, {3, 4, 3},
  {3, 4, 4}, {3, 5, 3}, {3, 5, 5}, {4, 1, 1}, {4, 1, 4}, {4, 2, 2}, {4,
2, 4}, {4, 3, 3}, {4, 3, 4}, {4, 4, 1}, {4, 4, 2},
  {4, 4, 3}, {4, 4, 5}, {4, 5, 4}, {4, 5, 5}, {5, 1, 1}, {5, 1, 5}, {5,
2, 2}, {5, 2, 5}, {5, 3, 3}, {5, 3, 5}, {5, 4, 4},
  {5, 4, 5}, {5, 5, 1}, {5, 5, 2}, {5, 5, 3}, {5, 5, 4}}

Length[%]
60

And here is the list containing THREE cycles

Cases[lst, Table[x_, {3}]]
{{1, 1, 1}, {2, 2, 2}, {3, 3, 3}, {4, 4, 4}, {5, 5, 5}}

Here is the list containing no two and three cycles

DeleteCases[lst, Alternatives @@ Permutations[{a_, b_, a_}]]
{{1, 2, 3}, {1, 2, 4}, {1, 2, 5}, {1, 3, 2}, {1, 3, 4}, {1, 3, 5}, {1,
4, 2}, {1, 4, 3}, {1, 4, 5}, {1, 5, 2}, {1, 5, 3},
  {1, 5, 4}, {2, 1, 3}, {2, 1, 4}, {2, 1, 5}, {2, 3, 1}, {2, 3, 4}, {2,
3, 5}, {2, 4, 1}, {2, 4, 3}, {2, 4, 5}, {2, 5, 1},
  {2, 5, 3}, {2, 5, 4}, {3, 1, 2}, {3, 1, 4}, {3, 1, 5}, {3, 2, 1}, {3,
2, 4}, {3, 2, 5}, {3, 4, 1}, {3, 4, 2}, {3, 4, 5},
  {3, 5, 1}, {3, 5, 2}, {3, 5, 4}, {4, 1, 2}, {4, 1, 3}, {4, 1, 5}, {4,
2, 1}, {4, 2, 3}, {4, 2, 5}, {4, 3, 1}, {4, 3, 2},
  {4, 3, 5}, {4, 5, 1}, {4, 5, 2}, {4, 5, 3}, {5, 1, 2}, {5, 1, 3}, {5,
1, 4}, {5, 2, 1}, {5, 2, 3}, {5, 2, 4}, {5, 3, 1},
  {5, 3, 2}, {5, 3, 4}, {5, 4, 1}, {5, 4, 2}, {5, 4, 3}}

Length[%]
60

And here is the subsets of lst

Cases[Union[Union /@ lst], Table[_, {3}]]
{{1, 2, 3}, {1, 2, 4}, {1, 2, 5}, {1, 3, 4}, {1, 3, 5}, {1, 4, 5}, {2,
3, 4}, {2, 3, 5}, {2, 4, 5}, {3, 4, 5}}

I hope I helped you a little.

Regards
Dimitris


  • Prev by Date: Re: RE:Beginner--[Please Help]How to get coefficient list issued from a Series Command
  • Next by Date: Re: Re: On order of options to Graphics
  • Previous by thread: General--Simple Permutations
  • Next by thread: Re: General--Simple Permutations