But thinking through it was great! Thank you for your analysis.

Here was my writeup

—-

After the first round, every chick has a 1/4 probability to be unpecked. (1/2^2)

Of the unpecked chicks,

1/2 are immortal singletons, and 1/2 are in pairs.

So there is a

1/4 * 1/2 = 1/8 chance of immediately becoming a singleton unpecked chicken and therefore immortal, plus a 1/8th chance of ending up in a pair of unpecked chicks. (And a 6/8th chance of being pecked).

For each unpacked pair, there are four outcomes:

1/4: a pecks b

1/4: b pecks a

1/4: a pecks b and b pecks a

1/4: neither pecks the other.

Let the number of immortal chicks coming from a pair = u. Then,

u = 1/2 + 1/4u

3/4u = 1/2

u = 2/3

From above, the expected fraction of *chicks in pairs* is 1/8, so the fraction of *pairs* is 1/16 of the total chick count.

1/8+ 1/16(2/3) ~= .1667

]]>In the statement of the Hurwitz theorem, should it be \((\sqrt{5}b^2)^{-1}\)? ]]>

If a, b are relatively prime positive integers, and if \(|bx-a|<|dx-c|\) for all pairs c, d of relatively prime positive integers satisfying \(d\le b\) and \(c/d\ne a/b\), then a/b is called a best approximation of the 2nd kind (BA2) to x. Every BA2 to x is a BA1 to x, but not conversely. A fraction is a BA2 to x if and only if it is a convergent of the continued fraction for x.

A theorem of Hurwitz states that for every real irrational x there are infinitely many rational approximations a/b with \(|bx-a|<(\sqrt5 b)^{-1}\). So if you use \(|bx-a|^{-1}\) as a measure of the merit of the approximation a/b, you'll find that every real irrational has a sequence of approximations of unbounded merit. If you use \((b|bx-a|)^{-1}\), you'll find that each quadratic irrational has only approximations of bounded merit. The precise behavior of \(\log|b\pi-a|/\log b\) as a/b runs through approximations to pi is not known.

]]>As for the Carnival — of course, I’d be delighted. ]]>

P.S. May I include a link to this post on this month’s Aperiodical Carnival of Mathematics?

]]>`tanton :: [Rational]`

tanton = [1] ++ map (1+) (zipWith (/) (scanl1 (+) tanton) [1..])

]]>One nitpick, why not “ghost” the grid lines for all graphs as done in the “fraction surviving sequential pecking” graph?

]]>In the single-round process, every chick pecks, and so after that round every chick must have at least one pecked neighbor. On the basis of this fact I claim that the surviving population can never be greater than \(\frac{N}{2}\).

it should say:

In the single round process, all N chicks peck and every pecked chick is pecked by at most 2 other. Therefore there are at least \(\frac{N}{2}\) pecked chicks, and the surviving population can never be greater than \(\frac{N}{2}\).

The reason why the first block is wrong is that in configurations other than a circle it is indeed possible that everyone has a pecked neighbor and more than \(\frac{N}{2}\) survive, so the conclusion doesn’t follow from the argument.

*(A correction that doesn’t detract anything from the fascinating nerdiness of this full post)*

First, thanks so much for pointing out my black-and-white confusion. Should be fixed now.

Second, I am grateful to now have a probability model that works and whose derivation makes sense, at least for the one-round-of-pecking case. “. . . the pecking state of the chick under consideration is irrelevant; so let’s stop thinking about it” — that’s a step in the analysis that I would not have thought to take.

Just for the record, here’s a comparison of your odd and even distributions with the empirical data:

They both appear to be spot on.

]]>Red is observed data; purple is the graph of your PDF. I thought it was just missing a factor of 2, so I tried doubling the amplitude *(bright green)*, but that curve is a little off, too. The sum of \(p(k)\) for \(0 \le k \le 12\) is about 0.48. Perhaps I’ve misunderstood what you’re aiming at.

I’m also unsure how to deal with \((N/2)!\) when \(N\) is odd — gamma function?

]]>Second: I believe I have a better explanation for your one-round results, at least in the case where you have an odd number of chicks.

Let’s start by computing the probability of seeing exactly \(k\) unpecked chicks out of \(n\) total (after the first round). A particular chick is unpecked if the chick to the left pecks to its left, and the chick to the right pecks to its right; only those two chicks matter. In particular, the pecking state of the chick under consideration is irrelevant; so let’s stop thinking about it. Where it might seem like we should look at neighborhoods of \(a-1, a, a+1\), we’ll instead look at neighborhoods (shifted by one) of \(a, a+2\) (ignoring the chick at \(a+1\)). We can combine multiple such neighborhoods into a chain \(a, a+2, a+4, \ldots\), where we wrap around at the end of the list. If \(n\) is even, there are two such chains; for example, \(n=8\) has \((1,3,5,7)\) and \((2,4,6,8)\). If \(n\) is odd, there is only one chain; \(n=7\) has \((1,3,5,7,2,4,6)\).

We can represent a chain as a sequence of letters \(L\) or \(R\). Then within a chain, there is a sequence \(LR\) iff the chick between these two chicks is unpecked. (Since we consider that chains wrap around, having \(L\) at the end of the sequence and \(R\) at the beginning also counts as an unpecked chick.) Now let’s look at the probability of seeing exactly \(k\) sequences \(LR\) in a random chain of length \(m\). We can compute this by checking how many of the \(2^m\) possible chains have \(k\) \(LR\) sequences.

Now, between every two “adjacent” \(LR\) sequences there is exactly one \(RL\) sequence; in other words, every chain has the same number of \(LR\) and \(RL\) sequences. If we count both \(LR\) and \(RL\) changes together, then a chain with \(k\) \(LR\) sequences will have \(2k\) changes. For any given chain we can define a change-chain. Start by adding \(n\) for “no change” or \(c\) for “change” between every pair of letters; so for the chain \(LLLRLLR\) we would end up with \(LnLnLcRcLnLcRc\). (That last \(c\) is “between” the final \(R\) and the initial \(L\).) Then delete the original \(L\)s and \(R\)s, so our example would end up as \(nnccncc\).

Every chain converts to a single change-chain; every change-chain is the conversion of exactly two chains (one where the first letter is an \(L\), one where the first letter is an \(R\)). An \(m\)-letter chain will have \(k\) \(LR\)s iff its change-chain has \(2k\) \(c\)s. So we only need to count the number of \(m\)-letter change-chains with exactly \(2k\) \(c\)s, which is simply \({m \choose 2k}\) (and then double that, because each change-chain corresponds to two chains). Then the probability of having \(k\) \(LR\) sequences in a random \(m\)-letter chain is \(2{m \choose 2k}/2^m\), or \({m \choose 2k}/2^{m-1}\).

Now if we go back to the original problem with \(n\) chicks, there are two cases. If \(n\) is odd, then it has a single chain of length \(n\), so the probability of having \(k\) unpecked chicks is

\[

{{n \choose 2k} \over 2^{n-1}}.

\]

If \(n\) is even, then it has two chains, each of length \(n/2\). Then the probability of having \(k\) unpecked chicks is

\[

\sum_{0 \leq a \leq k} {{n/2 \choose 2a}{n/2 \choose 2(k-a)} \over 2^{n-2}}.

\]

The probability in the even case is very messy (and I don’t know how to simplify it); also, I haven’t double-checked it, so there might be minor errors in the formula. So from now on I’ll concentrate on the odd case.

If we look at the formula for the odd case, it’s not a standard binomial distribution; but it’s close. If we started with the standard distribution \({n \choose k} / 2^n\), we can turn it into our distribution by discarding the values for odd \(k\) (and pushing the surviving values to the left, to keep them adjacent), and then doubling each probability (so that the probabilities sum to 1 after we discard half of them). We can use this to see how to approximate our distribution with a normal distribution. A standard binomial distribution \({n \choose k} / 2^n\) can be approximated by a normal distribution with mean \(n/2\) and standard deviation \(\sqrt{n}/2\). Since our \(n\)-chick distribution has half the mean and is half as wide as the standard binomial distribution, its approximating normal distribution will also have half the mean and half the standard deviation. So our \(n\)-chick distribution can be approximated by a normal distribution with mean \(n/4\) and standard deviation \(\sqrt{n}/4\) (at least when \(n\) is odd).

Since normal and binomial distributions are good approximations of each other, this \(n\)-chick normal distribution can in turn be approximated by a binomial distribution, which it turns out has parameters \(N’=n/3\) and probability \(p’=3/4\); but this is just an approximation of an approximation of the correct distribution, and I don’t believe that these \(N’\) and \(p’\) have any combinatorial meaning.

Third: I had a plan for how to approach the iterated problem. The plan didn’t work out, but I gathered some intriguing (and potentially useful) data on the way that I’d like to share.

My plan was to take the one-round results and record the number of singleton chicks and pairs of chicks separately. Then I would approximate them with separate normal distributions, multiply the mean and standard deviation of the pairs-of-chicks distribution by 1/3, and add the result back to the singleton-chicks distribution. (Using (incorrectly, as it turns out) the result that you can add normal distributions by adding their means and variances.) I hoped that this would give the correct mean and standard deviation of the experimental iterated distribution.

I decided to start with exact results, looking at all possible results of a small number of chicks; for \(n\) from 3 to 17, I computed the exact mean and variance of the distributions for all surviving chicks, all singleton surviving chicks, and all chicks surviving in pairs (which is always an even number). My first surprise was that the variance of the latter two distributions was actually higher than the variance of the former, even though the former distribution should be the sum of the latter two. Upon reflection, this makes sense; the result about adding normal distributions requires that the samples from the source distributions be independent, and our singleton-chick and paired-chick samples are evidently strongly anti-correlated (which seems obvious in retrospect).

The second surprise is that all of these means and variances turned out to be exact numbers of a particularly simple form. For \(n\) from 4 up, the all-chicks mean is \(n/4\), and the singleton-chicks and paired-chicks means are both \(n/8\). (Not too surprising… those are the asymptotically correct numbers, but I am a little surprised that they are exactly correct.) And for \(n\) from 7 up, the all-chicks variance is \(n/16\), the singleton-chicks variance is \(5n/64\), and the all-chicks variance is \(9n/64\). (Results are tested up to \(n=17\), which is where I got bored of waiting for my slow test code.)

I don’t know enough about statistics or probability to take this any further, so I’m giving up here (at least for now).

]]>\[p(k) = \frac{k^{N/2} (N/2-k)^{N/2}N!}{(N/2)^N ((N/2)!)^2} \]

This function is still not correct, as it gives zero probability to \(k = 0\) and \(k = N/2\), but it does not display the asymmetrical error of your binomial solution.

I guess that working out why this is a plausible limit is the next step!

]]>There’s another interesting observation about the setups that you consider. Each of the n-dimensional tori has a symmetry group that acts transitively, so that each chick is equal. Very mathematically intuitive, but what about different kinds of symmetry? Do the 2D cylinder and Mobius strip have the same survival statistics?

Some generalizations include chicks on regular graphs, or graphs in general, or directed graphs (which connected graph maximizes the survival rate?) as well as the case of nonlethal pecks (what if they’re only 50% effective?).

As is typical in discrete mathematics, there’s a wide range of generalizations for a simple question, and few of them actually correspond to real-world chicken behavior.

]]>