In the sequence {an}, Sn = 9n-n ^ 2, find the absolute value of TN = a1 + the absolute value of A2 +. + the absolute value of an

In the sequence {an}, Sn = 9n-n ^ 2, find the absolute value of TN = a1 + the absolute value of A2 +. + the absolute value of an

a1=S1=9-1=8.
an =Sn-S(n-1)= 9n-n^2-[9(n-1)-(n-1)^2]
=10-2n.
∴an=10-2n.(n∈N*)
Therefore, the first four terms of the sequence are positive, the fifth is 0, and the subsequent terms are negative
When n ≤ 5, TN = | A1 | + | A2 | + +|an|=Sn=9n-n^2.
When n > 5, TN = S5 + [- (sn-s5)] = 2 S5 SN
=2×5(8+0)/2-(9n-n^2)= n^2-9n+40.