|
|
Line 1: |
Line 1: |
| ==Problem== | | ==Problem== |
| Let <math>f(n,k)</math> be the number of ways distributing <math>k</math> candies to <math>n</math> children so that each child receives at most two candies. For example, <math>f(3,7)=0</math>, <math>f(3,6)=1</math>, and <math>f(3,4)=6</math>. Evaluate <math>f(2006,1)+f(2006,4)+f(2006,7)+\dots+f(2006,1003)</math>. | | Let <math>f(n,k)</math> be the number of ways distributing <math>k</math> candies to <math>n</math> children so that each child receives at most two candies. For example, <math>f(3,7)=0</math>, <math>f(3,6)=1</math>, and <math>f(3,4)=6</math>. Evaluate <math>f(2006,1)+f(2006,4)+f(2006,7)+\dots+f(2006,1003)</math>. |
− | apparently the proposers didnt get a closed form answer of this problem and somehow the previous solution here was wrong, this is standard roots of unity filter
| |
− | Let <cmath>f(n, k)</cmath> be the number of solutions <cmath>(x_1, x_2, \ldots, x_n)</cmath> to the equation
| |
− | <cmath>
| |
− | x_1 + x_2 + \cdots + x_n = k
| |
− | </cmath>
| |
− | where <cmath>x_i \in \{0, 1, 2\}</cmath> for <cmath>1 \le i \le n</cmath>. Equivalently, <cmath>f(n, k)</cmath> is the coefficient of <cmath>x^k</cmath> in the generating function
| |
− | <cmath>
| |
− | A(x) = (1 + x + x^2)^n.
| |
− | </cmath>
| |
− | Define
| |
− | <cmath>
| |
− | A(x) = \sum_{k=0}^{\infty} f(n, k) x^k.
| |
− | </cmath>
| |
− | Let <cmath>\omega \ne 1</cmath> be a primitive third root of unity. Then
| |
− | <cmath>
| |
− | \frac{1}{3} \left[ A(x) + \omega^2 A(\omega x) + \omega A(\omega^2 x) \right] = f(n,1)x + f(n,4)x^4 + f(n,7)x^7 + \cdots.
| |
− | </cmath>
| |
− | Plugging in <cmath>x = 1</cmath>, we obtain
| |
− | <cmath>
| |
− | \frac{1}{3} \left[ A(1) + \omega^2 A(\omega) + \omega A(\omega^2) \right] = f(n,1) + f(n,4) + f(n,7) + \cdots.
| |
− | </cmath>
| |
− | We compute:
| |
− | <cmath>
| |
− | A(1) = 3^n, \quad A(\omega) = 0, \quad A(\omega^2) = 0,
| |
− | </cmath>
| |
− | so the desired sum is
| |
− | <cmath>
| |
− | \frac{1}{3} \cdot 3^n = 3^{n-1}.
| |
− | </cmath>
| |
− | Thus, the final answer is <cmath>3^{2005}</cmath>.
| |
− | ~Ishan
| |
| | | |
| ==See also== | | ==See also== |