Suppose f(n)≤N for all n and f(n)=N eventually. If k>N, then f−1(Ik)=∅. If k≤N, the preimage contains all sufficiently large indices and is cofinite. Every open set therefore has open preimage, proving f is continuous. Together with the introductory argument this proves the claimed if-and-only-if classification.