how many terms are there in an arithmetric sequence if it has a common difference of 3 , a last term of 30 and the sum of its terms is 135

let the number of terms be n

last term: a + (n-1)d = 30
a + (n-1)(3) = 30
a + 3n - 3 = 30
a + 3n = 33
or a = 33 -3n

sum of n terms = 135
sum of terms = (n/2)(first + last)
(n/2)(a + 30) = 135
a + 30 = 270/n
subbing in the previous value of a
33-3n + 30 = 270/n
-3n^2 + 63n - 270 = 0
n^2 - 21n + 90 = 0
(n-15)(n-6) = 0

n = 15 or n = 6

if n = 15, a = 33-45 = -12
if n = 6, a = 33-18 = 15

check for n = 15 , a = -12, d=3
term15 = -12+14(3) = 30
sum15= (15/2)(-12+30) = 135

if n = 6 , a = 15, d=3
term6 = 15 + 5(3) = 30
sum6 = (6/2)(15+30) = 135

There are either 15 terms or there are 6 terms, both verify