Let $A$ and $B$ be nonempty finite sets of cardinalities $n$ and $m$, respectively. The *distance* between two functions $f, g : A \to B$ is defined as the number of disagreements between them, that is,
$$
d(f,g) := \# \{x\in A : f(x) \neq g(x)\}.
$$

Let $ 0 < k < n$. A set $F \subset B^A$ is called *$k$-separated* if $d(f,g) \ge k$ for every pair of distinct elements $f,g \in F$.

Main question:Is there an exact formula for the maximal cardinality $S(n,m,k)$ of a $k$-separated set?

Subsidiary question:Is there a simple combinatorial description of a $k$-separated set of maximal (or nearly maximal) cardinality?

It's easy to give bounds. The cardinality of a ``closed'' ball of radius $r$ is $$ B(n,m,r) := \sum_{j=0}^{r} \binom{n}{j} (m-1)^j. $$ If $M$ is a $k$-separated set of maximal cardinality (and therefore maximal) then the balls centered at points of $M$ and of radii $k-1$ (resp. $\lfloor k/2 \rfloor$) cover $B^A$ (resp. are disjoint), so: $$ \frac{m^n}{B(n,m,k-1)} \le S(n,m,k) \le \frac{m^n}{B(n,m,\lfloor k/2 \rfloor)} $$