Sx=x2[2a+(x−1)d]
Where a is the first term in sequence
171=x2[2×1+(x−1)×1]171=x2[2+x−1]342=x2+xx2+n−342=0x2+n−342=0x2+19x−18x−342=0x(x+19)−18(x+19)=0x=(−19,18)
Obviously it cannot be negative so answer is 18