Confusion regarding totally bounded metric spaces having cauchy subsequences of every sequence. My book says "A metric space $(X,d)$ is totally bounded if and only if every sequence in $X$ contains a cauchy subsequence."
Let us take a sequence $\{x_i\}$ such that for every prime number $p$, when $i$ is of the form $p^k$, $x_i$ or $x_{p^k}$ is part of the subsequence converging to $p$. For example, for $p=3$, $\{x_3,x_9,x_{27},\dots\}$ forms a cauchy subsequence converging to $3$. 
Clearly, this sequence contains infinite cauchy subsequences. But is it totally bounded? Any help with proving this sequence is totally bounded would be greaty appreciated. For a given $\epsilon\in\Bbb{R}$, selecting the primes as part of the finite set isn't an option, as there are an infinite number of them. 
Thanks in advance!
 A: In principle, the problem was already pointed out in the comments - let me just clarify this a little more:
The term "totally bounded" refers, as stated, to the metric space $(X,d)$, i.e. it is a property of the metric space and not of a single sequence in the metric space.
Now the statement reads that if a metric space is totally bounded, then every sequence contains a Cauchy-subsequence and conversely, if every (not only one!) sequence contains a Cauchy subsequence, then the space (not the sequence) is totally bounded. 
Intuitively, totally bounded means that you cannot diverge with your sequences. Either you converge (within the topological closure), or you somehow oscillate (meaning that eventually every point of your sequence is close to some point in the space and the set of these points is bounded). But this behaviour cannot be decided upon looking at a single sequence.
For your example (you have not really specified the metric space), if you take the subsequence $\{x_{i_j}\}_j$ where $i_j=p_j^{k_j}$ with $p_j$ the j-th prime number and $k_j$ sufficiently large, such that $|x_{i_j}-p_j|<\varepsilon$ for some prechosen $\varepsilon>0$, which is certainly a subsequence of your sequence and hence a sequence of the metric space, then this sequence does not contain a Cauchy-subsequence - therefore your space cannot be totally bounded. 
A: This is a very useful statement, since it readily follows that a metric space is compact iff it is complete and totally bounded. So I'll give a proof, even if that wasn't explicitly asked for.
Suppose $E$ is a totally bounded metric space. Let $\{p_n\}$ be a sequence in $E$ and $\varepsilon>0$. Then there exists a finite set of points $\{x_1, \ldots, x_m\}\subset E$ such that $$E=\bigcup_{j=1}^N B\left(x_j,\frac\varepsilon2\right).$$
Then one of these balls must contain $p_n$ for infinitely many $n$, which gives us a subsequence $\{p_{n_k}\}$ with $$d(p_{n_l}, p_{n_m}) \leqslant d(p_{n_l},x_j) + d(x_j, p_{n_m}) < \frac\varepsilon2 + \frac\varepsilon2=\varepsilon $$
for all $l, m$.
Conversely, if $E$ is not totally bounded, then there exists $\varepsilon>0$ such that for any finite subset $\{x_1,\ldots, x_N\}\subset E$, there exists $p\in E$ with $$p\notin\bigcup_{j=1}^N B(x_j,\varepsilon). $$
Let $p_1\in E$. Given $p_1,\ldots, p_N\in E$, choose $p_{N+1}\in E$ with $$p_{N+1}\notin\bigcup_{n=1}^N B(p_n,\varepsilon). $$
Then for all $N$, $d(p_n, p_N)\geqslant\varepsilon$ for $n>N$, and so $\{p_n\}$ cannot have a Cauchy subsequence.
