Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

Re: combinatorics problem

  • To: mathgroup at
  • Subject: [mg7551] Re: [mg7514] combinatorics problem
  • From: "w.meeussen" <w.meeussen.vdmcc at>
  • Date: Fri, 13 Jun 1997 19:37:51 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Gee, i must be thick today,
i don't understand why 

isn't enough to get what you want.

tell me where i'm off track.


At 10:48 10-06-97 -0400, Xah Lee wrote:
>A combinatorics related programing problem.
>I have a list Permutations[Range[n]]. I want to reduce the list by the
>following criteria:
>(1) Two lists are considered the same if one is the other shifted.
>(2) Two lists are considered the same if one is the other reversed.
>The following code captures my criteria.
>  Or@@(SameQ[li1,#]&/@
>          Flatten[{#,Reverse at #}&/@Table[RotateRight[li2,i],{i,Length at li2}],
>            1])/;(Length at li1==Length@li2)
>Ideally, I should get what I want by
>Union[Permutation[Range at n], SameTest->sameTestQ]
>but that doesn't work. The reason can be seen in the example:
>It returns the argument unchanged. The first and last elements are the same,
>but wasn't filtered out probably because Union only compare adjacent pairs
>after sorting.
>I'm working my way using DeleteCases or Select and I'll get it sooner or
>later. I'm wondering if you had similar problems and solutions before. It
>does looks like the best way is simply try to generate my list directly,
>perhaps by writing my own fuction. The problem is then a mathematical one.
>The solution answers the question: Given n points in space, in how many ways
>can one connect them together to form a loop.
> Xah
> xah at
> Mountain View, CA, USA

Dr. Wouter L. J. MEEUSSEN
eu000949 at
w.meeussen.vdmcc at

  • Prev by Date: Re: Creating table with multiple lists
  • Next by Date: mathematica problem
  • Previous by thread: combinatorics problem
  • Next by thread: Re: combinatorics problem