Given: AP has 40 terms, $S_9 = 153$, sum of last 6 terms = 687.
Step 1: Using $S_9 = 153$
$$S_9 = \frac{9}{2}[2a + 8d] = 153$$
$$2a + 8d = 34 \implies a + 4d = 17 \quad \text{...(i)}$$
Step 2: Sum of last 6 terms = 687
Sum of last 6 terms = $S_{40} - S_{34} = 687$
$$S_{40} = \frac{40}{2}[2a + 39d] = 20(2a + 39d)$$
$$S_{34} = \frac{34}{2}[2a + 33d] = 17(2a + 33d)$$
$$20(2a + 39d) - 17(2a + 33d) = 687$$
$$40a + 780d - 34a - 561d = 687$$
$$6a + 219d = 687 \implies 2a + 73d = 229 \quad \text{...(ii)}$$
Step 3: Solving (i) and (ii)
From (i): $a = 17 - 4d$. Substituting in (ii):
$$2(17 - 4d) + 73d = 229$$
$$34 + 65d = 229$$
$$d = 3$$
$$a = 17 - 12 = 5$$
First term $a = 5$, common difference $d = 3$
Step 4: Sum of all 40 terms
$$S_{40} = \frac{40}{2}[2(5) + 39(3)] = 20[10 + 117] = 20 \times 127 = \mathbf{2540}$$
Source: Chapter 5, Section 5.3 (Sum of first n terms of an AP)
---