I had this exercise:
Compute the limit $$ \lim_{n\to\infty} \frac{1^3+2^3+\cdots+n^3}{\sqrt{4n^8 +1}} $$
I tried two different approaches and got different answers.
Approach 1:
$$\begin{split} \lim_{n\to\infty} \frac{1^3+2^3+\cdots+n^3}{n^4\sqrt{4 +1/n^8}}&=\lim_{n\to\infty} \frac{\frac{1^3}{n^4}+\frac{2^3}{n^4}+\cdots+\frac{n^3}{n^4}}{\sqrt{4 +1/n^8}}\\ &=\lim_{n\to\infty} \frac{\frac{1^3}{n^4}+\frac{2^3}{n^4}+\cdots+\frac{1}{n}}{\sqrt{4 +1/n^8}}\\ &= \frac{0}{\sqrt{4+0}}\\ &= 0\\ \end{split}$$
Approach 2:
We substitute sum of cubes of $n$ natural numbers in the numerator and get
$$\begin{split} \lim_{n\to\infty} \frac{n^2(n+1)^2}{4n^4\sqrt{4 +1/n^8}}&= \lim_{n\to\infty} \frac{n^2(n+1)^2}{4n^4\sqrt{4 +1/n^8}}\\ &= \lim_{n\to\infty} \frac{n^4(1+\frac{1}{n})^2}{4n^4\sqrt{4 +1/n^8}}\\ &= \lim_{n\to\infty} \frac{(1+\frac{1}{n})^2}{4\sqrt{4 +1/n^8}}\\ &= \lim_{n\to\infty} \frac{1}{4\sqrt{4}}\\ &= \frac{1}{8}\\ \end{split}$$
I'm not sure why the two methods are giving me different answers and which one is correct?
In your first attempt, $n$ is also present as the number of terms. You cannot use "the limit of the sum is the sum of the limit" in that case. The same way you cannot say $$ \lim_{n\to\infty}\sum_{k=1}^n\frac1n=\sum_k0=0. $$ In this example the sum is $1$ for all $n$, and so the limit is $1$.