The integers \(1, 2, \ldots, 40\) are written on a blackboard. The following operation is then repeated 39 times: In each repetition, any two numbers, say \(a\) and \(b\), currently on the blackboard are erased and a new number \(a + b - 1\) is written. What will be the number left on the board at the end?
Show Hint
When a problem repeatedly combines numbers, track the change in the sum rather than simulating every step.
Initially, the sum of numbers on the board is:
\[
S_0 = 1 + 2 + 3 + \cdots + 40 = \frac{40 \times 41}{2} = 820
\]
When two numbers \(a\) and \(b\) are replaced by \(a + b - 1\), the total sum decreases by \(1\):
\[
S_{\text{new}} = S_{\text{old}} - 1
\]
This operation is repeated \(39\) times, so the final sum is:
\[
S_f = 820 - 39 = 781
\]
Since there is only one number left at the end, that number is \(\boxed{781}\).