# Elementary Number Theory and Its Application, 6th Edition by Kenneth H. Rosen Exercises 1.1.23

23. Find three different formulas or rules for the terms of a sequence ${a_n}$  if the first three terms of this sequence are  1,2,4.

Solution: We consider the first three terms of a sequence as 1,2,4

The simplest form of this sequence is

$a_n=2^{n-1}$
For $n=1,2,3,...$
We can even use recursive formula for this sequence, that is,
$a_1=1$
$a_2=2$
$a_n=a_{n-1}+2a_{n-2}$
For $n \geq 3$
We can also formulate the $nth$ term of this sequence by inspection.
$1=\frac{1^2-1+2}{2}$
$2=\frac{2^2-2+2}{2}$
$4=\frac{3^2-3+2}{2}$
Therefore, we have for $n=1,2,3,...$
$a_n=\frac{n^2-n+2}{2}$