Prepswift: Series III's practice question

Hey there, I am having trouble understanding how to achieve (n+1)/2 as the sum. Does (n+1)/2 come from S = n/2(a1 + an)?

No. This is not an arithmetic sequence. Try writing down the next few terms of the series - does the pattern become clear?

So this is what I got, please correct if I am wrong. Tbh I am not even sure if this is the right logic to solve this problem. I still feel like I am solving this the arithmetic way?

The first few term of the sequences: 1, -2, 3, -4, 5, -6…
Each pair is -1 (1-2, 3-4, 5-6, etc)
Which mean, the number of pairs would be (n-1)/2 + n (one extra n term since it’s odd)
And since each pair is -1, the sum is [(n-1)/2 +n] (-1) = (n+1)/2

Edit: I know that the pattern of the sum of the series is 1, -1, 2, -2, 3, -3 and so on. But I am puzzled on how to achieve (n+1)/2 using the pattern.

Your arithmetic solution is OK. Regarding the pattern-recognition approach, it’s all about noticing the relation:

  • When n = 1, sum is 1
  • When n = 3, sum is 2
  • When n = 5, sum is 3
  • When n = 7, sum is 4

So notice that when n = k, the sum is one more than half of n. Does that help?

Ah okay, got it. Thanks!