I want to prove the following statement: If $X\in \mathbb{R}^n$ has the property that every continuous function $f:X\to \mathbb{R}$ is bounded, then $X$ is compact.
So I thought a way of proving this was the contraposte the statement, together with Heine-Borel theorem.
Is this equivalent to show?:
If $X\subset \mathbb{R}^n$ is not closed and/or not bounded in the Euclidean metric d, then there exists a continuous function $f:X\to \mathbb{R}$ that is not bounded.
Also if yes, can I use that the norm function $\|x-y\|$ is continuous for a fixed to prove it?