Subjects combinatorics

Compositions Ones Twos 407620

Step-by-step solutions with LaTeX - clean, fast, and student-friendly.

Use the AI math solver

1. **Problem Statement:** Determine the number of compositions of 1s and 2s that sum up to 18. 2. **Understanding the Problem:** A composition of a number is a way of writing it as the sum of positive integers where order matters. Here, we only use 1s and 2s. 3. **Formula and Approach:** Let $f(n)$ be the number of compositions of $n$ using 1s and 2s. - For $n=1$, only one composition: 1, so $f(1)=1$. - For $n=2$, compositions are: 1+1, 2, so $f(2)=2$. For $n>2$, each composition either starts with 1 followed by a composition of $n-1$, or starts with 2 followed by a composition of $n-2$. Thus, the recurrence relation is: $$f(n) = f(n-1) + f(n-2)$$ 4. **Calculate $f(18)$ using the recurrence:** $f(1)=1$ $f(2)=2$ $f(3)=f(2)+f(1)=2+1=3$ $f(4)=f(3)+f(2)=3+2=5$ $f(5)=f(4)+f(3)=5+3=8$ $f(6)=f(5)+f(4)=8+5=13$ $f(7)=f(6)+f(5)=13+8=21$ $f(8)=f(7)+f(6)=21+13=34$ $f(9)=f(8)+f(7)=34+21=55$ $f(10)=f(9)+f(8)=55+34=89$ $f(11)=f(10)+f(9)=89+55=144$ $f(12)=f(11)+f(10)=144+89=233$ $f(13)=f(12)+f(11)=233+144=377$ $f(14)=f(13)+f(12)=377+233=610$ $f(15)=f(14)+f(13)=610+377=987$ $f(16)=f(15)+f(14)=987+610=1597$ $f(17)=f(16)+f(15)=1597+987=2584$ $f(18)=f(17)+f(16)=2584+1597=4181$ 5. **Answer:** The number of compositions of 1s and 2s that sum to 18 is **4181**.