I've asked this question before on stackexchange for any hints or suggestions. However, there weren't sufficient replies and I was not able to solve this question. So now I'm looking for a solution.
Let $A$ be a subset of the set of all non negative real numbers. It is required to show the existence of a metric space $X$, such that the set of all non-zero distances of $X$ equal the set $A$. All solutions will be highly appreciated.
Take $X = \{0\} \cup A$ and define $d:X^2 \to X$ by $$ d(a,b) = \begin{cases} 0 &\text{if } a=b,\\ \max\{a,b\} &\text{otherwise.} \end{cases} $$ This defines a distance because:
It is clear that for $a \in A$, we have $d(0,a)=a$, so $A \subseteq d(X^2)$.
If $a,b \in X$ are such that $a \neq b$, say, $a < b$, then $d(a,b) = b \in A$ because if $a < b$ then $b \neq 0$; so $d(X^2) \setminus \{0\} \subseteq A$. Hence $A = d(X^2) \setminus \{0\}$.