Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • $\begingroup$ Thank you very much for this polite stepwise education. My use of nested conditionals was both ugly and inefficient and I have learned (and will learn) a lot from your code examples. $\endgroup$ Commented Dec 18, 2012 at 2:39
  • $\begingroup$ sim4[] is wonderful...My summary: 1. Make a constant ary of zeroes to represent empty seats 2. Generate a random partition of Range[n] of size two with offset 1. This generates a possible final theatre set of side by side seats and the sample elements are just the part indices for the seats3. Fill empty side by side seats from your random sample 4. Use Magthematica's generalised trace to sum to 1s for the filled seats 5. The answer is just the complement normalized tp n...thank you as I said learned a lot! $\endgroup$ Commented Dec 18, 2012 at 3:12
  • $\begingroup$ @ubpdqn Glad I could help. A couple of more learned gents (than I) said sim4 is correct so apparently my caveat is unfounded. $\endgroup$ Commented Dec 18, 2012 at 3:50
  • 1
    $\begingroup$ Have been trouble with a long hyperlink and so deleted a number of comments. So using Google URL shortener here is my sharing of @Mr.Wizard sim4[] with some runs ubpdqnmathematica.wordpress.com/2012/12/18/… $\endgroup$ Commented Dec 18, 2012 at 5:17