Calculus limit question If $f:(0,+\infty)\rightarrow\mathbb{R}$  continuous
$$f(x)=\lim_{n\to\infty}\frac{3^n(x^3+ax^2+3x+1)+x^n(2x^3+6x^2+6x+2)}{2x^n+3^n} \hspace{0.5em} \forall x\in(0,3)\cup(3,+\infty) ,a\in \mathbb{R}$$Prove $f(x)=(x+1)^3 \hspace{0.2em},x>0 $
Ok so $$\Leftrightarrow f(x)=\lim_{n\to\infty}\frac{3^n(x^3+ax^2+3x+1)+2x^n(x+1)^3}{3^n+2x^n}$$
I've tried picking separate cases for $x>3$ while factoring $x^n$ and I got $f(x)=(x+1)^3 $ but for $x\in(0,3)$ factoring $3^n$ i get $f(x)=x^3+ax^2+3x+1$. What am I missing?

Something is wrong here. For $a=0$ and $x=1$ we have
$$f(1)=\lim_{n\to\infty}\frac{3^n(1+3+1)+1^n(2+6+6+2)}{2\cdot 1^n+3^n}=\lim_{n\to\infty}\frac{5\cdot 3^n+16}{3^n+2}=5\neq 8=(1+1)^3$$
The formula only works if $a=3$.

EDIT: As @enzotib pointed out, the function $f(x)$ is assumed to be continuous. Really, this exercise should have been phrased: Given that $f(x)$ is continuous and defined by
$$f(x)=\lim_{n\to\infty}\frac{3^n(x^3+ax^2+3x+1)+2x^n(x+1)^3}{3^n+2x^n}$$
for some $a\in\mathbb{R}$, find $a$ and show that with this choice of $a$ $f(x)=(x+1)^3$.
Then what you are missing is showing that
$$\lim_{x\to 3^{-}}f(x)=37+9a$$
$$\lim_{x\to 3^{+}}f(x)=64$$
This lets you find $a$ and complete the problem.
