← All lessons

Stars and Bars (Hard)

Late AMC 10/12 through early AIME — dense computation.

Stars and Bars: core idea

Bounds + inclusion-exclusion.

Example problem: hint and answer

Positive integers x1+⋯+x5=20x_1+\cdots+x_5=20 with each xi≤7x_i\le 7. How many solutions?

Hint: Inclusion-exclusion after yi=xi−1y_i=x_i-1. Answer: 1451.

Practice (9 problems — type your answers)

  • 1. Partitions of 1212 into exactly 44 parts. How many?

  • 2. Surjective functions [8]→[3][8]\to[3]. How many?

  • 3. Positive integers x≤y≤zx\le y\le z with 1x+1y+1z=1\frac1x+\frac1y+\frac1z=1. Count triples.

  • 4. Catalan C7C_7.

  • 5. Nonnegative solutions to x1+2x2+3x3=30x_1+2x_2+3x_3=30.

  • 6. Choose 55 from {1,…,20}\{1,\ldots,20\} with no two consecutive. How many?

  • 7. Coefficient of x15x^{15} in ∏k=15(1+xk+x2k+⋯ )\prod_{k=1}^{5}(1+x^k+x^{2k}+\cdots).

  • 8. Positive 66-tuples summing to 2020 with gcd⁡=1\gcd=1. Count?

  • 9. Ways to write 2020 as ordered sum of powers of 22 (parts ≥1\ge1)?

Stars and Bars Practice Problems — Hard