## Problem of the Day #109: Recursive Functions Are CoolJuly 6, 2011

Posted by Alex in : potd , trackback

Given the recursive function, $f(x) =$
$$\begin{cases} 0 & \text{if } x \le 2 \\ 1 + \frac{f(x – 3) + f(x – 2) + f(x – 1)}{3} & \text{if } x > 2 \text{ and } x \equiv 0 \pmod{3} \\ 2 + \frac{6f(x – 3) + 3f(x – 2) – f(x – 1)}{8} & \text{if } x > 2 \text{ and } x \equiv 1 \pmod{3} \\ 3 + \frac{f(x – 3) + 2f(x – 2) + f(x – 1)}{4} & \text{if } x > 2 \text{ and } x \equiv 2 \pmod{3} \end{cases},$$
find the nearest integer to $f(2222)$. Feel free to use a four-function calculator (nothing except for $+$, $-$, $\times$, and $\div$).

Tags: