The first term of an AP is 6 and the fifth term is 18. Find the number of terms in the series having a sum of 162

Let's denote the common difference of the arithmetic progression (AP) as $d$.

The first term, $a_1$, is given as 6, and the fifth term, $a_5$, is given as 18.

Using the formula for the general term of an AP, we can write:
$a_1=6$
$a_5=6+4d=18$

Subtracting 6 from both sides of the second equation, we have:
$4d=18-6=12$

Dividing both sides by 4, we find that $d=3$.

Now, we want to find the number of terms $n$ such that the sum of the terms is 162.

Using the formula for the sum of the first $n$ terms of an AP, we can write:
$S_n = \frac{n}{2}(2a_1+(n-1)d)$

Substituting $a_1=6$ and $d=3$, we have:
$162 = \frac{n}{2}(2(6)+(n-1)(3))$

Simplifying the equation:
$162 = 3n + 3n^2 -3n$

Rearranging the equation:
$3n^2 + 3n -162 = 0$

Dividing both sides of the equation by 3, we get:
$n^2 + n - 54 = 0$

Factoring the quadratic equation, we have:
$(n + 9)(n - 6) = 0$

Setting each factor equal to zero and solving for $n$, we find that $n=-9$ or $n=6$.

Since the number of terms cannot be negative, the number of terms in the series with a sum of 162 is $n=6$.