I'm trying to find out if there is any continuous function $f : \mathbb{R}\to \mathbb{R}$ such that $f(\mathbb{R}\setminus K)$ is not open for all $K$ compact.
Since in $\mathbb{R}$ every compact is closed and bounded, the set $\mathbb{R}\setminus K$ is open and unbounded. So if there was a continuous function such that the image of any open set is not open it would suffice.
I know there are continuous functions which are not open, that is, that may not map some open sets to open sets, but a continuous function which doesn't map any open set to open set is quite different and I'm failing to see if such a function do exist or not.
Is there any continuous function with this property? How can we see that such a function can or cannot exist?
Edit: Although it wasn't made clear on the question, I'm wondering if there is a function satisfying this property which is not constant. The constant function clearly satisfies this, but I'm asking other functions than constant ones.
Take $f$ to be a constant function.