Finding a function for a table

I have tried to find just one function for this table and cannot. I have tried adding, subtracting, multiplying, dividing and exponential. This is my son's 5th grade math question and I am being dense. Can you please help me find a formula?

Input Output

3 21

6 42

9 27

12 36

Thank you!!

Re: Finding a function for a table

Quote:

Originally Posted by

**pj389** I have tried to find just one function for this table and cannot. I have tried adding, subtracting, multiplying, dividing and exponential. This is my son's 5th grade math question and I am being dense. Can you please help me find a formula?

Input Output

3 21

6 42

9 27

12 36

Thank you!!

$\displaystyle f(3n) =\begin{cases}21\cdot n, & \text{if }n \in \{1,2\} \\9 \cdot n, & \text{if }n \in \{3,4\}\end{cases}$