$f(nx)\to 0$ as $n\to+\infty$
Let $f:\mathbb R^+\to\mathbb R^+$ be a continuous function, and let $I$ be a subset of $\mathbb R^+$ such that the following property holds:
For any $x\in I$, $f(nx)\to 0$ as $n\to+\infty$.
Intuitively, if $I$ is 'big' enough, $f$ necessarily tends to $0$ at infinity, but it happens to not always be the case. I am investigating whether it can be said, for various $I$, if
$f(x)\to 0$ as $x\to+\infty$.
As a first example, consider $I=[0,1]$. Set $\varepsilon>0$, and consider the closed sets $F_n=\{x\in I\mid f(kx)<\varepsilon,\forall k\geq n\}$. Their union is $[0,1]$, and thus, thanks to the property of Baire, one of them has non-empty interior, i.e. $[a,b]\in F_n$ for a certain $n$. It follows that for all $k\geq n$ and $x\in[ka,kb]$, $f(x)<\varepsilon$. But since $b>a$, $\bigcup_{k=n}^\infty [ka,kb]$ contains a half-line, and $\limsup_{x\to\infty} f(x) \leq \varepsilon$. Since the reasoning holds for any $\varepsilon>0$, we conclude that $f$ does, indeed, tend to $0$ at infinity. The same proof actually works for all $I$ with non-empty interior.
The result is false in higher dimensions when $I$ contains a neighbourhood of the origin, as a simple counter-example can be constructed using a parabola.
What happens when $I\subset \mathbb R$ is smaller? Consider the following sets:
$I$ is any measurable set with empty interior, but with Lebesgue measure >0. In that case, one of the aforementioned $F_n$ has positive Lebesgue measure.
$I=(0,1)\cap C$, where $C$ is the Cantor set (or another uncountable set). Then, one of the $F_n$ has to be uncountable aswell,
$I=\{1/k,k\in\mathbb N\}$ or $I=(0,1)\cap \mathbb Q$, both of these being equivalent. I provided an answer below for this one, and actually for any countable set; such a function $f$ does not necessarily converge to $0$.
In any of these cases, can anything be said about the behaviour of $f$ at infinity?
Bonus question: what is the minimum condition for $I$ (if there is one) so that $f$ has to converge to $0$?
I thought about mimicking the proof of the first example when $I$ has empty interior but positive Lebesgue measure. If there exists an integer $n$ and a non-trivial interval $[a,b]$ such that $|F_n\cap [a,b]|=b-a$, then $f\leq\varepsilon$ on a set that is dense on a half-line, and thus, using continuity, tends to $0$. Sadly, such an interval may not exist, since the closure of $F_n$ could very well be of empty interior, like a generalized Cantor set.
Solution 1:
Let $I=\{1/k, k\in\mathbb N\}$.
Consider the function $f$ defined on every interval $[n,n+1]$ like so:
$$ f(x)=\begin{cases} 1-2n\left|n+\frac{1}{2n}-x\right| &\text{if }x\in[n,n+1/n] \\ 0 & \text{if }x\in[n+1/n,n+1] \end{cases} $$
$f$ is continuous on $\mathbb R^+$, and satisfies the hypothesis
For any $x\in I$, $f(nx)\to 0$ as $n\to+\infty$.
In fact, this function could have been chosen to be smooth, and the construction holds for any countable set. Indeed, if $I=\{x_k,k\in\mathbb N\}$, then we can construct a function $f$ which has a spike on $[1,2]\backslash(x_1\mathbb N)$, then another one on $[2,3]\backslash(x_1\mathbb N\cup x_2\mathbb N)$, and so on and so forth, since $[n,n+1]\backslash(\bigcup_{i=1}^nx_i\mathbb N)$ has non-empty interior.
Solution 2:
At the first I remark that your proof works for all non-meager $I$ (that is which are not a countable union of nowhere dense sets). From the other hand, let $I$ be a meager subset of $\mathbb R^+$. Choose a sequence $\{F_n\}$ of closed nowhere dense sets such that $F_n\subset [1/n;n]$ for each $n$ and $\bigcup F_n\cup \{0\}\supset I$. The family $\mathcal F=\{mF_n:m\ge n^2\}$ is locally finite, so a set $F=\bigcup\mathcal F$ is closed. Since the set $F$ is meager, by Baire theorem, it does not contain a half-line. This means there exists a sequence $S=\{x_n\}\subset\mathbb R^+\setminus\{0\}$ which goes to infinity. Thus the set $S$ is closed. Since the closed sets $F\cup\{0\}$ and $S$ are disjoint and the space $\mathbb R^+$ is normal, there exists a continuous function $f: \mathbb R^+\to \mathbb R^+$ such that $f(F\cup\{0\})=0$ and $f(S)=1$. Therefore there exists arbitrary large $x$ such that $f(x)=1$, but for each $x\in I$ $f(nx)$ eventually gets $0$.