I'm wondering if $\sup_{x \in M} f(x) = \max_{x \in M} f(x)$ holds when $f$ is some arbitrary function and $M = \{0,1,\dots,n\}$ for some $n \in \mathbb N$.
My idea is that $M$ is closed and bounded as a (finite) union of closed and bounded sets containing one element each, so its compact due to Heine-Borel and if $f$ is continous then this equality will hold. But what if $f$ is not continous? Also what happens in the limit $n \to \infty,$ so that $M = \mathbb N_0$?
Thanks!