A cute problem from reddit.
You have 2n people standing in an infinite row at spots say 1,2,3,..,2n (one person at each spot). A scientist performs the following steps repeatedly.
Clone every person on the row, and move the clones one position the right i.e. if there were x people at position k, you create x clones and place them at position k+1. Note that this is done for every position in parallel (so no moving clones twice etc). Previously empty positions could see folks being moved there.
After 2n−1 repeats of the above steps, how many people will be there at position n?
Scroll down for a solution.
.
.
.
Suppose there are pj people at position j (j>=1).
Then the steps is basically replacing pk+1 with pk+1+pk
This looks ripe for matrices, the steps are basically a linear transformation, but the matrix is large, of size 4n−1 or so.
There is another way to look at this: polynomials!
Let f(z)=∞∑n=1pnzn
(Even though there is infinity, it is still a finite polynomial as all pi=0 after a certain point)
Then the steps are basically replacing f(z) by f(z)(z+1)
Initially f(z)=z+z2+⋯+z2n
After 2n−1 steps we get
(z+z2+⋯+z2n)(1+z)2n−1=
(z+z2+⋯+z2n)(2n−1∑r=0(2n−1r)zr)
(using binomial theorem on (1+z)2n−1)
The number of people in row n is coefficient of zn and that comes out to be
n∑r=0(2n−1r)=22n−12=22n−2
(using (2n−1r)=(2n−12n−1−r) and adding them up to get 22n−1)
No comments:
Post a Comment