collection $\mathcal{B}$ of subsets $V = \{ x + yk : k \in \mathbb{Z} \} $ for $x,y \in \mathbb{Z}$ form a basis for some topology of $\mathbb{Z}$ 
Problem:
The collection $\mathcal{B}$ of subsets of the form $V = \{ x + yk : k
> \in \mathbb{Z} \} $ for $x,y \in \mathbb{Z}$ is a basis for some
  topology of $\mathbb{Z}$

Solution attempt:
Pick $n \in \mathbb{Z}$. and Put $N = \{ nk : k \in \mathbb{Z} \} $. Clearly $n \in N$ and hence $N$ is a neighborhood of $n$.
Now, suppose $N_1= \{kn \}, N_2= \{ k'n\}$ are two neighborhoods of some $n \in \mathbb{Z}$. We must find a nhbd $N_3$ such that $n \in N_3 \subseteq N_1 \cap N_2 $. If we take $N_3 = \{ \max\{k,k'\} n \} $ then it would do the job. 
Also, I would like to know if this topology is compact. How can we conclude it is not compact? Is this topology Hausdorff?
 A: I’m going to assume that the definition of $\mathscr{B}$ given in the question is slightly incorrect, and that $\mathscr{B}$ is actually the collection of all sets of the form $a+b\Bbb Z=\{a+bk:k\in\Bbb Z\}$ such that $a,b\in\Bbb Z$ and $b\ne 0$; without that last restriction $\{a\}\in\mathscr{B}$ for each $a\in\Bbb Z$, and $\mathscr{B}$ is trivially a base for the discrete topology on $\Bbb Z$, which of course is not compact.
Your argument that $\mathscr{B}$ covers $\Bbb Z$ is correct but unnecessarily complicated, since $\Bbb Z\in\mathscr{B}$. The next bit, however, does not make sense: $\{kn\}$ is a set containing one integer, $kn$, and is not in $\mathscr{B}$. If you really meant $\{kn:k\in\Bbb Z\}$, which is in $\mathscr{B}$, then $N_1$ and $N_2$ are the same set. Moreover, there are members of $\mathscr{B}$ containing $n$ that are not of this form. You need to start with completely arbitrary $N_1,N_2\in\mathscr{B}$ with $n\in N_1\cap N_2$. Let $N_1=a_1+b_1\Bbb Z$ and $N_2=a_2+b_2\Bbb Z$; then there are $k_1,k_2\in\Bbb Z$ such that $n=a_1+b_1k_1=a_2+b_2k_2$. Now you need to find $a,b\in\Bbb Z$ with $b\ne 0$ such that $n\in a+b\Bbb Z\subseteq\big((a_1+b_1\Bbb Z)\cap(a_2+b_2\Bbb Z)\big)$.
This actually takes a little work. Perhaps the most straightforward approach is to begin by showing that if $n\in r+s\Bbb Z$, then $r+s\Bbb Z=n+s\Bbb Z$. Thus, if $n\in N_1\cap N_2$, then $$(a_1+b_1\Bbb Z)\cap(a_2+b_2\Bbb Z)=(n+b_1\Bbb Z)\cap(n+b_2\Bbb Z)\;,$$
and you need only show that $(n+b_1\Bbb Z)\cap(n+b_2\Bbb Z)=n+m\Bbb Z$, where $m=\mbox{lcm}(b_1,b_2)$.
$\Bbb Z$ with this topology is not compact: the set of primes is an infinite, closed, discrete subset. (If $p$ is prime, find an open nbhd of $p$ that contains only multiples of $p$; if $n$ is composite, find an open nbhd of $n$ that contains only composite numbers.)
Added: To show that the space is Hausdorff, let $m,n\in\Bbb Z$ with $m\ne n$. Let $p$ be any positive integer that does not divide $n-m$, e.g., a prime larger than $|n-m|$; then $m+p\Bbb Z$ and $n+p\Bbb Z$ are disjoint open nbhds of $m$ and $n$, respectively. They are clearly open nbhds of $m$ and $n$. If $k\in(m+p\Bbb Z)\cap(n+p\Bbb Z)$, then there are integers $r$ and $s$ such that $k=m+pr=n+ps$. But then $n-m=pr-ps=p(r-s)$, where $r-s$ is an integer, so $p$ divides $n-m$, contradicting the choice of $p$.
Let $P$ be the set of positive primes. If $p\in P$, then $p\Bbb Z=0+p\Bbb Z$ is an open nbhd of $p$ that does not contain any other prime: if $q$ is a prime different from $p$, then $p$ is not a divisor of $q$, so $q\notin p\Bbb Z$. Thus, $(p\Bbb Z)\cap P=\{p\}$, each $p\in P$ is an isolated point of $P$, and $P$ is therefore discrete. Now suppose that $n\in\Bbb Z\setminus P$. If $n$ is composite, then every multiple of $n$ is either composite or $0$, so $n\Bbb Z$ is an open nbhd of $n$ disjoint from $P$. If $n=0$, then $4\Bbb Z$ is an open nbhd of $n$ disjoint from $P$, since every element of $4\Bbb Z$ is $0$ or a multiple of $4$ and therefore not prime. The only remaining possibility is that $n=-p$ for some $p\in P$. In that case $-p+3p\Bbb Z$ is an open nbhd of $n$ disjoint from $P$: every element of $-p+3p\Bbb Z$ is a multiple of $p$, so $p$ is the only prime that could possibly belong to $-p+3p\Bbb Z$, and it doesn’t, since $\frac23$ isn’t an integer.
A: Let $\mathscr{F}$ be a filter of subgroups in an abelian group $G$ (written additively). Consider the family 
$$\mathscr{B}=\{\,x+H:x\in G,H\in\mathscr{F}\,\}.$$
Then $\mathscr{B}$ is a base for a topology on $G$. We need to see that the intersection of two elements of the family is a union of elements of the family, since it's obvious that the family covers $G$.
There are two cases: either $(x+H)\cap(y+K)=\emptyset$, and there's nothing to prove, or
$$
(x+H)\cap(y+K)=z+(H\cap K)
$$
where $z$ is any element in the intersection. Indeed, if $z$ belongs to the intersection, then $x+H=z+H$ and $y+K=z+K$. Now $(z+H)\cap(z+K)=z+(H\cap K)$ is shown easily.
The set of nonzero subgroups of $\mathbb{Z}$ is a filter, because the intersection of two nonzero subgroups is nonzero. I'll assume you mean $y\ne0$ in your setting, otherwise the topology would be discrete. The topology you get is known as the natural topology on $\mathbb{Z}$.
Denote by $\mathbb{Z}_2$ the ring of $2$-adic integer. Then the canonical embedding $\mathbb{Z}\to\mathbb{Z}_2$ is continuous when the natural topology is considered on $\mathbb{Z}$, because the inverse image of $2^n\mathbb{Z}_2$ is just $2^n\mathbb{Z}$. Since the integers are dense in $\mathbb{Z}_2$, which is a compact group, being the inverse limit of finite groups, it follows that $\mathbb{Z}$ with the natural topology is not compact.
