[A] is the sum of the first 998 consecutive positive integers, so it has 998 terms in it.
Gauss's method involved doubling the sum while grouping terms in a clever way: let <em>S</em> be the sum, so that
<em>S</em> = 1 + 2 + 3 + ... + 996 + 997 + 998
It's also true that
<em>S</em> = 998 + 997 + 996 + ... + 3 + 2 + 1
so that adding these equations together gives
2<em>S</em> = (1 + 998) + (2 + 997) + ... + (997 + 2) + (998 + 1)
2<em>S</em> = 999 + 999 + ... + 999 + 999
We know there are 998 terms on the right side, so
2<em>S</em> = 998 * 999 = 997,002
<em>S</em> = 997,002/2 = 498,501
[B] You can do this one the same way. The hardest part is counting how many terms there are in the sum.
Starting with 1, the <em>n</em>-th positive odd integer is given by 2<em>n</em> - 1. The last term in this sum is 101, so
2<em>n</em> - 1 = 101
2<em>n</em> = 102
<em>n</em> = 102/2 = 51
and the sum contains 51 terms.
Let <em>S</em> denote the sum. Then
<em>S</em> = 1 + 3 + 5 + ... + 97 + 99 + 101
<em>S</em> = 101 + 99 + 97 + ... + 5 + 3 + 1
2<em>S</em> = (1 + 101) + (3 + 99) + ... + (99 + 3) + (101 + 1)
2<em>S</em> = 102 + 102 + ... + 102 + 102
2<em>S</em> = 51 * 102 = 5202
<em>S</em> = 5202/2 = 2601