Solution (source code)

= Solution

The cover $X=\bigcup_{n\in X}U_n$ has no finite subcover, because every $U_n$ is finite. Hence \b[$X$ is not compact].

For the stated <pasting lemma for closed subspaces>, if $C\subset Z$ is closed, then
$$
f^{-1}(C)=(A\cap f^{-1}(C))\cup(B\cap f^{-1}(C))
$$
is a union of two closed subsets of $Y$; therefore $f$ is continuous.

For $m,n\in X$, let $q=mn$. On $[0,\tfrac12]$ define a path equal to $m$ before the endpoint and equal to $q$ at the endpoint; it is continuous because every open set containing $q$ also contains its divisor $m$. On $[\tfrac12,1]$ define it to equal $q$ at the first endpoint and $n$ thereafter. This is likewise continuous. The two closed-interval paths agree at $1/2$, so the pasting lemma joins them into a path from $m$ to $n$. Thus \b[$X$ is path-connected].