How could I describe a function whose domain is x>=1 for integers, starts at 3 f(1)=3, then multiplied by 2 f(2)=6, then by 3 f(3)=18, repeat

145 Views Asked by At

$$f(1)=3 \quad f(2)=6\quad f(3)=18\quad f(4)=36 \quad f(5)=108$$

How can I define this function? The function is recursive and multiplies by 2 then 3 alternatively. I know I could solve this in code, but I'm not sure of the mathematical terms one could use to make a function like this. Let me know if I'm not clear and thank you for any help.

2

There are 2 best solutions below

5
On BEST ANSWER

How about $f(n)=3^{\lceil n/2\rceil}\cdot 2^{\lfloor n/2\rfloor}$? Here $\lceil x\rceil$ denotes the smallest integer not less than $x$, and $\lfloor x\rfloor$ is the largest integer not greater than $x$.

0
On

For each $k\in\mathbb{N}$ we can express

$$ \begin{array}{l l} f(2k-1)&= 3^k 2^{k-1} \\ f(2k) &= 3^k 2^k \end{array} .$$