0
$\begingroup$

$$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.

$\endgroup$
  • $\begingroup$ Can you please fix the title? It doesn't make any sense. $\endgroup$ – dfeuer Sep 19 '13 at 7:37
  • $\begingroup$ What doesn't make sense. $\endgroup$ – Philip Rego Sep 19 '13 at 19:58
5
$\begingroup$

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$.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ What do you mean by smallest and largest integer. This function works for the even numbers, but I'm not sure what that notation is. $\endgroup$ – Philip Rego Sep 19 '13 at 8:25
  • 1
    $\begingroup$ @PhilipRego The notation is for the floor and ceiling functions. You can think of it as rounding up (for ceiling) and (down) for floor to the nearest integer. For example, the floor of 2.5 (the largest integer not greater than 2.5) is 2. The floor of 7 is 7. $\endgroup$ – Mike Sep 19 '13 at 9:06
  • $\begingroup$ See en.wikipedia.org/wiki/Floor_and_ceiling_functions $\endgroup$ – primoz Sep 19 '13 at 9:15
  • $\begingroup$ This only needs to work for integers. And it doesn't work for the odd numbers f(1) doesn't equal 3 $\endgroup$ – Philip Rego Sep 19 '13 at 20:00
  • $\begingroup$ It works for integers, and f(1)=3, since $\lceil 1/2\rceil$=1 and $\lfloor 1/2\rfloor$=0. You can prove the rule is correct by induction. $\endgroup$ – primoz Sep 23 '13 at 20:18
1
$\begingroup$

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} .$$

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.