Q:

How to calculate the nth term of a sequence which has repeating, determined differences?

I've covered quadratics and linear sequences and I've already got my feet into deep water with them, but I've never encountered this kind of sequence:
3, 15, 33, 39, 51, 69
The sequence evidently goes up by +12, +18, +6, +12, +18 and goes on and on...
I'd like to know how to find out its nth term and what the name of that kind of sequence is.
All help would be appreciated, thank you.

A:

We can see
$$a_{3m+1}=39+36(m-1)=36m+3,$$
$$a_{3m-1}=15+36(m-1)=36m-21,$$
$$a_{3m}=33+36(m-1)=36m-3.$$
Hence, we get
$$a_n=\begin{cases}12n-9\ \ \ \text{if $n\not\equiv 0\pmod3$}\\12n-3\ \ \ \text{if $n\equiv 0\pmod3$}\end{cases}$$
So, noting that 
$$\left\lceil\frac{n+3}{3}\div\left\lfloor\frac{n+3}{3}\right\rfloor-1\right\rceil=\begin{cases}1\ \ \ \text{if $n\not\equiv 0\pmod3$}\\0\ \ \ \text{if $n\equiv 0\pmod3$}\end{cases}$$
we get
$$a_n=12n-9+6\left(1-\left\lceil\frac{n+3}{3}\div\left\lfloor\frac{n+3}{3}\right\rfloor-1\right\rceil\right)\ \ \ (n=1,2,\cdots).$$

