A Topology such that the continuous functions are exactly the polynomials
Solution 1:
Currently, this is more an elongated comment than an answer ...
Consider the case $K=\mathbb R$. Such a topology $\mathcal T$ has to be invariant under translations, scaling, and reflection because $x\mapsto ax+b$ with $a\ne 0$ is a homeomorphism.
(cf. JimBelks comments above) Assume there is a nonempty open set $U$ bounded from below, then wlog. (by translation invariance) $U\subseteq (0,\infty)$ and hence $(0,\infty)=\bigcup_{r>0}rU$ is open. By reflection, also $(-\infty,0)$ is open and by the pasting lemma, $x\mapsto|x|=\begin{cases}x&\text{if }x\ge0\\-x&\text{if }x\le 0\end{cases}$ is continuous, contradiction. Therefore all nonempty open sets are unbounded from below, and by symmetry also unbounded from above.
Especially, all nonempty open sets are infinite. Let $U$ be a nonempty open neighbourhood of $0$. Let $I$ be a standard-open interval, i.e. of the form$I=(-\infty,a)$, $I=(a,\infty)$, or $I=(a,b)$. Assume $|U\cap I|<|\mathbb R|$ and $0\notin I$. Then the set $\{\frac xy\mid x,y\in U\cap I\}$ does not cover all of $(0,1)$, hence for suitable $c\in(0,1)$, the open set $U\cap cU$ is disjoint from $I$ and nonempty (contains $0$). If $I$ itself is unbounded this contradicts the result above. Therefore (by symmetry) $$|U\cap(a,\infty)|=|U\cap(-\infty,a)|=|\mathbb R|$$ for all nonempty open $U$ and $a\in\mathbb R$. However, if $I=(a,b)$ is bounded and $U\cap I=\emptyset$, then $\bigcup_{ca+d<a\atop cb+d>b} (cU+d) =(-\infty,a)\cup (b,\infty)$ is open. Taking inverse images under a suitable cubic, one sees that all sets of the form $(-\infty,a)\cup c,d)\cup (b,\infty)$ are open and ultimately all open neighbourhoods (in the standard topology!) of the point at infinity in the one-point compactification of $\mathbb R$ are open. A topology containing only these sets would describe "continuity at infinity" and make polynomials continuous - but also many other functions. Anyway we have:
$|U\cap (a,b)|=|\mathbb R|$ for all nonempty $U$ and bounded intervals $(a,b)$, or all (standard) open neighbourhoods of $\infty$ are open.
Since $x\mapsto |x|$ is continuous under the indiscrete topology, there exists an open set $\emptyset\ne U\ne \mathbb R$. Wlog. $0\notin U$. Then $\bigcup_{c>0}cU=K\setminus\{0\}$ is open, hence
points are closed.
So $\mathcal T$ is coarser than the cofinite topology. Since $x\mapsto |x|$ is continuous under the cofinite topology, it is strictly coarser, i.e. there exists an open set $U\ne \emptyset $ such that $\mathbb R\setminus U$ is infinite.
Solution 2:
Some hopefully-correct thoughts about Jim Belk's proposal for the real numbers:
Polynomials in that topology are continuous, because for polynomials $p$ and $q$, $q^{-1}(p^{-1}(\Bbb Z))=(p\circ q)^{-1}(\Bbb Z)$.
The topology is coarser than the usual one, so the space is connected. It's also $T_1$, because $\Bbb Z+x$ and $\pi \Bbb Z+x$ are closed for each $x$. So it at least meets the basic requirements we've laid out already.
Since the preimage of each integer under a given polynomial is finite, each sub-basic closed set is countable, so in fact every closed set is countable. We know then, that the topology must be somewhere between cofinite and cocountable. It is easy to see that it must be strictly between, because the nonconstant continuous functions in the cofinite (cocountable) topology are those which take no value more than finitely (countably) often.
Moreover, a polynomial takes only finitely many integer values on any bounded set, so in fact the subspace topology on any bounded set is cofinite. This also means that any nontrivial closed set is order-isomorphic to a subset of $\mathbb{Z}$.
We can also conclude, since any two nonempty subsets have nonempty intersection, that it is hyperconnected, therefore not $T_2$, and thus not a topological group under any operation. Furthermore, no finite collection of closed sets covers any nonempty open set, so in the absence of a locally finite closed cover, even the strongest form of the pasting lemma does not apply.
Solution 3:
In a comment on the original post, Jim Belk proposed the topology on $\mathbb{R}$ with a subbasis given by the collection of all sets of the form $\mathbb{R}\setminus p^{-1}(\mathbb{Z})$, where $p\in\mathbb{R}[x]$.
Alas, this topology does not work. In particular, I claim that the function $f(x)=\arctan x$ is continuous w.r.t. this topology.
Proof: As pointed out in another answer here, a polynomial takes only finitely many integer values on any bounded set. So $p^{-1}(\mathbb{Z})\cap(-\pi/2,\pi/2)$ is finite for any polynomial $p$. It follows that for any proper closed set $C$, we have that $f^{-1}(C)$ is a finite set and therefore closed (because this topology is $T_1$). Q.E.D.
Note: We can avoid this difficulty by using, say, the rationals, or the dyadic rationals, in lieu of the integers.