Let $f:\mathbb{R}\to\mathbb{R}$. It is well known that a definition for the limit of $f$ to infinity is the following one: $$\lim_{x\to\infty}f(x)=l\in\overline{\mathbb{R}}\iff$$ $$\forall (a_n)_{n\geq0}\text{ such that }\lim_{n\to\infty}a_n=\infty\text{, we have that }\lim_{n\to\infty}f(a_n)=l$$
Now, I stumbled on a situation where I thought that the conclusion immediately follows from the definition above. I had that $$\forall k\in(0,\infty):\;\lim_{n\to\infty}f(nk)=l\in\overline{\mathbb{R}}$$ where $l$ was fixed and I wanted to get $$\lim_{x\to\infty}f(x)=l$$ Obviously, my condition is not equivalent the hypothesis of the definition above and I want to find out whether or not it implies it. At this point, I'm not even sure if an additional condition on $f$, like continuity would do the job. Thanks in advance.