<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Math help for the right brained</title>
	<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained/</link>
	<description>Comments on Ask MetaFilter post Math help for the right brained</description>
	<pubDate>Sat, 28 Apr 2007 13:28:14 -0800</pubDate>
	<lastBuildDate>Sat, 28 Apr 2007 13:28:14 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Math help for the right brained</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained</link>	
		<description>I have a math question involving combinations and sets. &lt;br /&gt;&lt;br /&gt; I just participated in my first MeFi CD swap, and I got to wondering if there was an algorithmic way to make sure each round&apos;s swap sets are as unique as possible. IANAMathPerson, so here&apos;s a wordy explanation of the problem:&lt;br&gt;
&lt;br&gt;
Let&apos;s say we have 9 people who are going to be split up into groups of 3 over several rounds. How can I determine how many unique combinations there are? &lt;br&gt;
&lt;br&gt;
For an example of this size, it&apos;s trivial by hand:&lt;br&gt;
Round 1: [ABC] [DEF] [GHI]&lt;br&gt;
Round 2: [ADG] [BEH] [CFI]&lt;br&gt;
Round 3: [AEI] [BFG] [CDH]&lt;br&gt;
Round 4: [AFH] [BDI] [CEG]&lt;br&gt;
&lt;br&gt;
4 rounds, no one ever shares a set with the same person twice, and there are no further unique solutions. For larger sets of size N and subsets of size K, is there an equation that will tell me how many unique combinations can be made?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2007:site.61533</guid>
		<pubDate>Sat, 28 Apr 2007 13:10:35 -0800</pubDate>
		<dc:creator>sonofslim</dc:creator>
		
			<category>math</category>
		
			<category>combinations</category>
		
			<category>combinatorials</category>
		
	</item> <item>
		<title>By: tylermoody</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926462</link>	
		<description>There&apos;s not an easy way to do it mathematically, but you could program something that would create groups along your rules very simply.&lt;br&gt;
&lt;br&gt;
I&apos;m not sure why you&apos;re mentioning subsets.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926462</guid>
		<pubDate>Sat, 28 Apr 2007 13:28:14 -0800</pubDate>
		<dc:creator>tylermoody</dc:creator>
	</item><item>
		<title>By: Steven C. Den Beste</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926483</link>	
		<description>The total number of ways that nine items can be ordered is 9 factorial.&lt;br&gt;
&lt;br&gt;
If you take such a list and divide it into threes, then you have to weed out all the cases where a given set of three are the same members but in different orders. The number of reorderings of three members is 3 factorial.&lt;br&gt;
&lt;br&gt;
So the total is 9!/(3!*3!*3!) == 1680</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926483</guid>
		<pubDate>Sat, 28 Apr 2007 14:13:30 -0800</pubDate>
		<dc:creator>Steven C. Den Beste</dc:creator>
	</item><item>
		<title>By: kid ichorous</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926485</link>	
		<description>Off the top of my head, isn&apos;t the answer:&lt;br&gt;
&lt;br&gt;
(N c K) * ((N-K) c K) * ((N-2K) c K) * ... * (K c K) / K!&lt;br&gt;
&lt;br&gt;
whenever N is divisible by K?&lt;br&gt;
&lt;br&gt;
That is, (9 &lt;a href=&quot;http://en.wikipedia.org/wiki/Combinatorics#Combinations&quot;&gt;combination&lt;/a&gt; 3) times (6 combination 3) times 1, all divided by 3 factorial, to account for re-orderings among the groups but not within them?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926485</guid>
		<pubDate>Sat, 28 Apr 2007 14:18:40 -0800</pubDate>
		<dc:creator>kid ichorous</dc:creator>
	</item><item>
		<title>By: Steven C. Den Beste</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926487</link>	
		<description>My solution permits [CDE] and [CDF] as being acceptable unique cases. Excluding all cases where any two have previously been in a group is more difficult and I&apos;m not sure how you&apos;d calculate that.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926487</guid>
		<pubDate>Sat, 28 Apr 2007 14:19:58 -0800</pubDate>
		<dc:creator>Steven C. Den Beste</dc:creator>
	</item><item>
		<title>By: kid ichorous</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926494</link>	
		<description>Hmm, SCDB, my method has an extra 3! on the bottom, giving 240 rather than 1680.  This extra 3! is because you can reorder the groups themselves, a la:&lt;br&gt;
&lt;br&gt;
[ABC][DEF][GHI] ~ [DEF][ABC][GHI]</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926494</guid>
		<pubDate>Sat, 28 Apr 2007 14:28:56 -0800</pubDate>
		<dc:creator>kid ichorous</dc:creator>
	</item><item>
		<title>By: kid ichorous</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926497</link>	
		<description>To further strip this down so that no two members can ever occupy a group twice is nontrivial.  I&apos;ll have to think about that a little!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926497</guid>
		<pubDate>Sat, 28 Apr 2007 14:30:53 -0800</pubDate>
		<dc:creator>kid ichorous</dc:creator>
	</item><item>
		<title>By: Wolfdog</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926498</link>	
		<description>SCDB fails, overcounting by a factor of more than 400.&lt;br&gt;
&lt;br&gt;
The answer to the question &quot;How many ways can a group of N people be broken up into K groups&quot; is called a Stirling Number of the Second Kind, S(N,K).  It&apos;s not as easy to compute as a binomial coefficient, but it&apos;s exceedingly well-studied.  &lt;br&gt;
&lt;br&gt;
Your problem, however, where we insist on all groups having the same size is a problem of &quot;combinatorial designs,&quot; and in general it&apos;s hard.  However, the answers for small values are &lt;a href=&quot;http://www.cs.brown.edu/~sello/golf.html&quot;&gt;here&lt;/a&gt;.  (Site has shitty MIDI music, I&apos;m sorry.) &lt;br&gt;
&lt;br&gt;
(For N=15 broken into blocks of three this problem is widely known as Kirkman&apos;s Schoolgirl Problem).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926498</guid>
		<pubDate>Sat, 28 Apr 2007 14:34:38 -0800</pubDate>
		<dc:creator>Wolfdog</dc:creator>
	</item><item>
		<title>By: kid ichorous</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926504</link>	
		<description>Nice, Wolfdog!  That &quot;no two members&quot; condition made it a lot harder.  &lt;br&gt;
&lt;br&gt;
Also, that music just screams &quot;social golfer problem.&quot;  As in, it&apos;s time for an intervention.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926504</guid>
		<pubDate>Sat, 28 Apr 2007 14:44:48 -0800</pubDate>
		<dc:creator>kid ichorous</dc:creator>
	</item><item>
		<title>By: sonofslim</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926506</link>	
		<description>Yes, it is the non-trivial case I am puzzling over.&lt;br&gt;
&lt;br&gt;
Here&apos;s some more info, if it makes my question and the reasoning behind it any clearer:&lt;br&gt;
&lt;br&gt;
I&apos;ve already written a script that generates permutations of a set. If a permutation passes the uniqueness test, it gets added to the list of known solutions. (The test is agnostic to the order of the groups, or the order within any group.)&lt;br&gt;
&lt;br&gt;
The challenge is, what happens when I&apos;ve exhausted all of the unique permutations? I&apos;d want to come up with a permutation that has the least amount of repetition with a prior round. In this example, round 5 would ideally contain just 2 pairs that have already shared a group. So I added a ranking function to my script, which orders permutations based on how many past pairings they repeat.&lt;br&gt;
&lt;br&gt;
The nut of my question, then, is how do I know when to switch from &quot;find unique answer&quot; behavior to &quot;find next best answer&quot; behavior. If I knew when I&apos;d already found the maximum # of unique permutations, this would be easy.&lt;br&gt;
&lt;br&gt;
The algorithm that generates permutations does it cyclically, so stepping one at a time from ABCDEFGHI to a permutation that fits my rules would take a very long time. It would be absurdly inefficient for any non-trivial number of elements. Thus, my program actually looks at permutations in a random order -- turns out this is a pretty quick way to find solutions. But it also means I can&apos;t search exhaustively for unique permutations. At some point I need to fall back to behavior #2. If I knew when that was ahead of time, I wouldn&apos;t have to waste cycles looking for solutions that don&apos;t exist.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926506</guid>
		<pubDate>Sat, 28 Apr 2007 14:49:29 -0800</pubDate>
		<dc:creator>sonofslim</dc:creator>
	</item><item>
		<title>By: Wolfdog</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926513</link>	
		<description>When I say &quot;hard&quot; I mean &quot;I&apos;m pretty sure that the site I&apos;ve linked gives all values that are currently known.&quot;  It also gives you the breakdown into sets if you click on the numbers, so unless you&apos;re deadset on reproducing the work by yourself...&lt;br&gt;
&lt;br&gt;
(To be clear, the linked site &lt;i&gt;does&lt;/i&gt; address the &quot;no repeated pairings&quot; condition.)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926513</guid>
		<pubDate>Sat, 28 Apr 2007 14:54:47 -0800</pubDate>
		<dc:creator>Wolfdog</dc:creator>
	</item><item>
		<title>By: sonofslim</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926533</link>	
		<description>Bummer, I was really hoping for a pretty solution. Thanks for warning me before I spent much more time puzzling over this, though!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926533</guid>
		<pubDate>Sat, 28 Apr 2007 15:58:16 -0800</pubDate>
		<dc:creator>sonofslim</dc:creator>
	</item><item>
		<title>By: Blazecock Pileon</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926550</link>	
		<description>I was playing with Mathematica to see if I could come up with an algorithmic way to do this, and I made some progress you might be able to build upon.&lt;br&gt;
&lt;br&gt;
I used Robert M. Dickau&apos;s BellList function &lt;a href=&quot;http://mathforum.org/advanced/robertd/bell.html&quot;&gt;outlined here&lt;/a&gt;. &lt;br&gt;
&lt;br&gt;
I wrote a function to separate out the three-part partitions of the set of nine elements from the BellList. &lt;br&gt;
&lt;br&gt;
Of those three-part partitions, only 280 contain three-element subsets.&lt;br&gt;
&lt;br&gt;
You could build a list from the output, pick one of the 280 and then filter out from the remaining 279 those partitions which do not follow your uniqueness criteria. &lt;br&gt;
&lt;br&gt;
I&apos;m still a little puzzled about this criteria given the example you provide (I think there should be more than four permutations &#8212; for example, [ADH][BEG][CFI] would work for the second round, right?).&lt;br&gt;
&lt;br&gt;
In any case, you&apos;d do something like &lt;code&gt;partitionList = {};&lt;/code&gt; at the top and &lt;code&gt;partitionList = Append[partitionList, BellList[9][[i]]];&lt;/code&gt; at the bottom of the code, where the &lt;code&gt;tally&lt;/code&gt; variable is incremented.&lt;br&gt;
&lt;br&gt;
Once you have &lt;code&gt;partitionList&lt;/code&gt; you have a set of partitions on which you can apply your rules.&lt;br&gt;
&lt;br&gt;
Here&apos;s the code:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;In[3] := BellList[1] = {{{1}}};(*the basic case*)&lt;br&gt;
&lt;br&gt;
In[4]:= BellList[n_Integer?Positive] := BellList[n] = (* do some caching *)&lt;br&gt;
&lt;br&gt;
&amp;nbsp;Flatten[&lt;br&gt;
&amp;nbsp;&amp;nbsp;Join[&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;Map[ReplaceList[#, {S__} -&amp;gt; {S, {n}}] &amp;amp;, BellList[n - 1]],&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;Map[ReplaceList[#, {b___, {S__}, a___} -&amp;gt; {b, {S, n}, a}] &amp;amp;, BellList[n - 1]]], 1]&lt;br&gt;
&lt;br&gt;
In[5]:= Dimensions[BellList[9]]&lt;br&gt;
Out[5]= {21147}&lt;br&gt;
&lt;br&gt;
In[9]:= &lt;br&gt;
tally = 0;&lt;br&gt;
For[i = 1, i &#8804; Length[BellList[9]], Increment[i],&lt;br&gt;
&amp;nbsp;If[Length[BellList[9][[i]]] == 3,&lt;br&gt;
&amp;nbsp;&amp;nbsp;flag = True;&lt;br&gt;
&amp;nbsp;&amp;nbsp;For[j = 1, j &#8804; 3, Increment[j],&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;If[ Length[BellList[9][[i]][[j]]] &#8800; 3, flag = False; j = 4; ]&lt;br&gt;
&amp;nbsp;&amp;nbsp;]&lt;br&gt;
&amp;nbsp;&amp;nbsp;If[flag, Print[BellList[9][[i]]]; Increment[tally];]&lt;br&gt;
&amp;nbsp;]&lt;br&gt;
];&lt;br&gt;
Print[tally];&lt;br&gt;
&lt;br&gt;
From In[9]:=&lt;br&gt;
{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}&lt;br&gt;
{{1, 2, 4}, {3, 5, 6}, {7, 8, 9}}&lt;br&gt;
{{1, 2, 5}, {3, 4, 6}, {7, 8, 9}}&lt;br&gt;
{{1, 2, 6}, {3, 4, 5}, {7, 8, 9}}&lt;br&gt;
{{1, 3, 4}, {2, 5, 6}, {7, 8, 9}}&lt;br&gt;
{{1, 3, 5}, {2, 4, 6}, {7, 8, 9}}&lt;br&gt;
{{1, 3, 6}, {2, 4, 5}, {7, 8, 9}}&lt;br&gt;
{{1, 4, 5}, {2, 3, 6}, {7, 8, 9}}&lt;br&gt;
{{1, 4, 6}, {2, 3, 5}, {7, 8, 9}}&lt;br&gt;
{{1, 5, 6}, {2, 3, 4}, {7, 8, 9}}&lt;br&gt;
...&lt;br&gt;
{{1, 6, 9}, {2, 7, 8}, {3, 4, 5}}&lt;br&gt;
{{1, 7, 8}, {2, 6, 9}, {3, 4, 5}}&lt;br&gt;
{{1, 7, 9}, {2, 6, 8}, {3, 4, 5}}&lt;br&gt;
{{1, 8, 9}, {2, 6, 7}, {3, 4, 5}}&lt;br&gt;
280&lt;/code&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926550</guid>
		<pubDate>Sat, 28 Apr 2007 16:29:03 -0800</pubDate>
		<dc:creator>Blazecock Pileon</dc:creator>
	</item><item>
		<title>By: Wolfdog</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926552</link>	
		<description>So far, so good, BP, but now from a list of 280 partitions, you have to choose a maximal subset subject to the criterion that no two elements are ever grouped together in more than one of the partitions you select.  That&apos;s the hard part.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926552</guid>
		<pubDate>Sat, 28 Apr 2007 16:39:36 -0800</pubDate>
		<dc:creator>Wolfdog</dc:creator>
	</item><item>
		<title>By: Wolfdog</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926553</link>	
		<description>Also, here&apos;s a shorter version of what you&apos;ve already done:&lt;br&gt;
&lt;br&gt;
&lt;  discretemath`br&gt;
Select[KSetPartitions[9, 3], Length /@ # == {3, 3, 3} &amp;amp;]&lt;/&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926553</guid>
		<pubDate>Sat, 28 Apr 2007 16:44:19 -0800</pubDate>
		<dc:creator>Wolfdog</dc:creator>
	</item><item>
		<title>By: Wolfdog</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926554</link>	
		<description>Oh, that&apos;s just great.&lt;br&gt;
&lt;br&gt;
&amp;lt;&amp;lt;DiscreteMath`&lt;br&gt;
Select[KSetPartitions[9,3],Length/@#=={3,3,3}&amp;amp;]</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926554</guid>
		<pubDate>Sat, 28 Apr 2007 16:46:06 -0800</pubDate>
		<dc:creator>Wolfdog</dc:creator>
	</item><item>
		<title>By: Blazecock Pileon</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926557</link>	
		<description>All that work! I wish I knew how to use Mathematica better...</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926557</guid>
		<pubDate>Sat, 28 Apr 2007 16:49:16 -0800</pubDate>
		<dc:creator>Blazecock Pileon</dc:creator>
	</item><item>
		<title>By: rasputin98</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926574</link>	
		<description>Very elegant Wolfdog! Yes, like BP, I wish my Mathematica foo was better. This whole thread has been quite illuminating.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926574</guid>
		<pubDate>Sat, 28 Apr 2007 17:25:29 -0800</pubDate>
		<dc:creator>rasputin98</dc:creator>
	</item><item>
		<title>By: sonofslim</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926802</link>	
		<description>So... full disclosure, I failed college calculus twice and this discussion was over my head by the third answer. What I&apos;m gathering is that it would be a better use of time (and probably easier) to work on a good best-case-failure algorithm than to try to crack this nut, right?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926802</guid>
		<pubDate>Sat, 28 Apr 2007 22:43:59 -0800</pubDate>
		<dc:creator>sonofslim</dc:creator>
	</item><item>
		<title>By: Wolfdog</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926921</link>	
		<description>If you need to know the largest number of rounds that can be run according to your criteria - that is, &quot;What&apos;s the very largest number of rounds can we run before some two people have to be in the same group again&quot; - then, yes, unfortunately, finding that number is a computationally intractable problem.&lt;br&gt;
&lt;br&gt;
But the fact that finding the largest possible number (and being certain it&apos;s largest) is hard doesn&apos;t mean you can&apos;t have some success constructing reasonably large solutions.  If I were doing this for a practical application, here&apos;s how I&apos;d most likely start:&lt;br&gt;
&lt;br&gt;
First,&lt;br&gt;
&lt;br&gt;
1.  Construct one set of swap groups for the first round.  (You might as well just number the people in the group and put them in groups by order for the first set, just like you did in your example.)&lt;br&gt;
&lt;br&gt;
Then,&lt;br&gt;
&lt;br&gt;
2.  Check to see if it&apos;s possible to add another round to the rounds we&apos;ve already done.&lt;br&gt;
3.  If so, add a round by constructing a new set of swap groups compatible with the ones we already have.  If there are any choices to be made, make them randomly.  Then return to step 2.&lt;br&gt;
3.  Otherwise, stop and print out the list.&lt;br&gt;
&lt;br&gt;
Now, it&apos;s unlikely you&apos;ll get a list of the largest possible number of rounds right off the bat.  But because of the randomization, you can rerun this until you get a list with as many rounds as you want, or you become convinced that such a list is very unlikely to exist.   I believe you&apos;ll find that reasonably large solutions turn up fairly quickly; then it&apos;s just a matter of how many times you want to rerun it trying for something better.&lt;br&gt;
&lt;br&gt;
Step 2, the checking part, shouldn&apos;t be too hard if you maintain a list of all pairs of people that have been grouped together up to the current point.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926921</guid>
		<pubDate>Sun, 29 Apr 2007 06:47:15 -0800</pubDate>
		<dc:creator>Wolfdog</dc:creator>
	</item><item>
		<title>By: sonofslim</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#926972</link>	
		<description>I found this paper about the &lt;a href=&quot;http://www.cs.brown.edu/~pvh/social.pdf&quot;&gt;social golfers problem&lt;/a&gt;; looks interesting and I&apos;m hoping I can make my way through the math. &lt;small&gt;* sharpens pencil *&lt;/small&gt; &lt;br&gt;
&lt;br&gt;
I do have a real-world application in mind for this, I&apos;m sure I would have ended up chasing my tail without everyone&apos;s help. Interesting stuff to think about nonetheless. Thanks a bunch!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-926972</guid>
		<pubDate>Sun, 29 Apr 2007 08:34:38 -0800</pubDate>
		<dc:creator>sonofslim</dc:creator>
	</item><item>
		<title>By: euphotic</title>
		<link>http://ask.metafilter.com/61533/Math-help-for-the-right-brained#939272</link>	
		<description>With a set of size N and subsets of size K, consider the subsets  of which you are a member. You have K-1 fellow members in each set. And your fellow members must be different in each set. So there can be no more than (N-1)/(K-1) rounds, otherwise you would be grouped with someone in more than one round.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.61533-939272</guid>
		<pubDate>Fri, 11 May 2007 04:22:39 -0800</pubDate>
		<dc:creator>euphotic</dc:creator>
	</item>
	</channel>
</rss>
