[proofplan]
We prove the cyclic chain (1) $\Rightarrow$ (2) $\Rightarrow$ (3) $\Rightarrow$ (1). For (1) $\Rightarrow$ (2), if $f(X)$ misses a value $c$ between two attained values, then $f^{-1}((-\infty,c))$ and $f^{-1}((c,\infty))$ disconnect $X$. For (2) $\Rightarrow$ (3), a continuous integer-valued [function](/page/Function) with interval image must be constant. For (3) $\Rightarrow$ (1), a disconnection of $X$ produces a non-constant continuous function into $\mathbb{Z}$.
[/proofplan]
[step:Prove (1) $\Rightarrow$ (2): connected $X$ implies every continuous real-valued function has interval image]
Suppose $X$ is connected and $f: X \to \mathbb{R}$ is continuous. Let $a, b \in f(X)$ with $a < b$, and let $c \in (a,b)$. We show $c \in f(X)$.
Suppose for contradiction that $c \notin f(X)$. Define $U = f^{-1}((-\infty, c))$ and $V = f^{-1}((c, \infty))$. Since $(-\infty,c)$ and $(c,\infty)$ are open in $\mathbb{R}$ and $f$ is continuous, both $U$ and $V$ are open in $X$. They are non-empty: since $a \in f(X)$ with $a < c$, there exists $x \in X$ with $f(x) = a \in (-\infty, c)$, so $x \in U$; similarly $V \neq \varnothing$. They are disjoint: $(-\infty,c) \cap (c,\infty) = \varnothing$. Since $c \notin f(X)$, every $x \in X$ satisfies either $f(x) < c$ or $f(x) > c$, so $U \cup V = X$. This is a disconnection of $X$, contradicting (1). Therefore $c \in f(X)$, and $f(X)$ is an interval.
[/step]
[step:Prove (2) $\Rightarrow$ (3): interval-image property implies every continuous $\mathbb{Z}$-valued function is constant]
Let $g: X \to \mathbb{Z}$ be continuous, where $\mathbb{Z}$ carries the discrete [topology](/page/Topology). Viewing $g$ as a continuous map into $\mathbb{R}$, hypothesis (2) implies $g(X)$ is an interval in $\mathbb{R}$. But $g(X) \subseteq \mathbb{Z}$, and the only intervals contained in $\mathbb{Z}$ are singletons (if $m, n \in \mathbb{Z}$ with $m < n$ both lie in an interval $I$, then the non-integer $(m+n)/2 \in I$ when $n - m \geq 2$, contradicting $I \subseteq \mathbb{Z}$; if $n = m + 1$, then $(m + m+1)/2 = m + 1/2 \in I$, again contradicting $I \subseteq \mathbb{Z}$). Therefore $g(X)$ is a singleton, and $g$ is constant.
[/step]
[step:Prove (3) $\Rightarrow$ (1): constant $\mathbb{Z}$-valued functions imply $X$ is connected]
Suppose $X$ is not connected. Then $X = U \cup V$ with $U, V$ open, non-empty, and disjoint. Define $g: X \to \mathbb{Z}$ by $g(x) = 0$ for $x \in U$ and $g(x) = 1$ for $x \in V$. The preimage of any subset $S \subseteq \mathbb{Z}$ is a union of some subcollection of $\{U, V\}$: specifically $g^{-1}(S)$ is $\varnothing$, $U$, $V$, or $X$ depending on which of $0, 1$ belong to $S$. Each of these is open in $X$, so $g$ is continuous. Since $g$ takes both values $0$ and $1$, it is non-constant, contradicting (3). Therefore $X$ is connected.
[/step]