Find a formula for a sequence of number A sequence starts at $n=1$: $\{1, 4, 13, 40, 121, 364... \}$.

Find an explicit formula that generates these numbers.

Thanks a lot!
A good technique to employ on such problems is to calculate the differences between consecutive terms. Here you get:

$$\begin{array}{rcc}
n:&amp;1&amp;2&amp;3&amp;4&amp;5&amp;6\\
a_n:&amp;1&amp;4&amp;13&amp;40&amp;121&amp;364\\
a_n-a_{n-1}:&amp;&amp;3&amp;9&amp;27&amp;81&amp;243
\end{array}$$

The numbers in the last line should look very familiar: they’re consecutive powers of $3$. It appears that $a_n=1+3+3^2+\ldots+3^{n-1}$; to get your answer, just find the sum of the geometric series.

Since you included the (recursion) label, you might also note that since the bottom line of the table seems to show that $a_n-a_{n-1}=3^{n-1}$, the sequence is apparently generated by the recurrence and initial datum

$$\left\{\begin{align*}
&amp;a_1=1\\
&amp;a_n=a_{n-1}+3^{n-1}\text{ if }n&gt;1\;.
\end{align*}\right.$$

(The recurrence could just as well start with $a_0=0$.)
The Correct answer is 

((3^n)-1)/2  
n=1 --&gt;  3-1/2=1
n=2 --&gt;  9-1/2=4
n=3 --&gt;  27-1/2=13
n=4 --&gt;  81-1/2=40
n=5 --&gt;  243-1/2=121
n=6 --&gt;  729-1/2=364
.
. 
.