In an arithmetic sequence, consecutive terms differ by a fixed number d :
[tex]a_8=a_7+d[/tex]
[tex]a_9=a_8+d=a_7+2d[/tex]
[tex]a_{10}=a_9+d=a_7+3d[/tex]
and so on up to
[tex]a_{19}=a_7+12d[/tex]
Solve for d :
[tex]140=32+12d\implies12d=108\implies d=9[/tex]
Work backwards to find the first term in the sequence, and hence the n-th term:
[tex]a_6=a_7-d[/tex]
[tex]a_5=a_6-d=a_7-2d[/tex]
and so on down to
[tex]a_1=a_7-6d[/tex]
So the first term is
[tex]a_1=32-6\cdot9=-22[/tex]
which means the n-th term is
[tex]a_n=a_1+(n-1)d=-22+9(n-1)=9n-31[/tex]
[tex]S_n[/tex] denotes the n-th partial sum of the sequence, i.e. the sum of the first n terms. We want to find the number of terms such that this sum is 511:
[tex]\displaystyle S_n=\sum_{i=1}^na_i=\sum_{i=1}^n(9i-31)=511[/tex]
Distribute the summation and recall the formulas,
[tex]\displaystyle\sum_{i=1}^n1=n[/tex]
[tex]\displaystyle\sum_{i=1}^ni=\frac{n(n+1)}2[/tex]
[tex]\implies S_n=\displaystyle9\sum_{i=1}^ni-31\sum_{i=1}^n1[/tex]
[tex]\implies511=9\cdot\dfrac{n(n+1)}2-31n[/tex]
[tex]\implies1022=9n^2-53n[/tex]
[tex]\implies9n^2-53n-1022=0[/tex]
[tex]\implies(n-14)(9n+73)=0[/tex]
[tex]\implies n=14\text{ or }n=-\dfrac{73}9[/tex]
n must be a positive integer, so we the sum is obtained from the first n = 14 terms.