Suppose you had $N$ many fixed points $X_1, X_2, ..., X_N$ in some Euclidean space $R^d$ and from these coordinates you had to choose $n$ many of them ($n \leq N$ also being fixed) to form a subset $S$ that maximizes the function $f(S) = \sum_{(i,j) \in S \times S} ||X_i-X_j||^2$. How would you choose $S$? Note that $||\cdot||$ is the usual Pythagorean norm.

Informally, you are choosing the n points so that they are as 'distant' from each other as possible. Is there a solution to this problem or at least an algorithmic approach to this problem? Solutions to this problem involving different functions that encode the notion of being 'far apart' would interest me as well.