Using some Mathematica, we we let $h(m,n)$
be defined as 
$$
 h(m,n) = \max_{f : [n] \to [m] } | \mathrm{image}(f) |.
$$

For small combinations of $(m,n)$, we get the table
$$
\begin{array}{cccccccc}
 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \\
 1 & 3 & 5 & 8 & 12 & 16 & 21 & 27 \\
 1 & 3 & 6 & 9 & 13 & 18 & 24 & 31 \\
 1 & 3 & 6 & 10 & 14 & 19 & 25 & 32 \\
 1 & 3 & 6 & 10 & 15 & 20 & 26 & 33 \\
\end{array}
$$
and the main diagonal are the numbers you found.
Rows are indexed by $m$.

Some search in the OEIS suggests that we (almost always have)
$$
h(m,n) = \text{Number of edges in $(m+1)$-partite Turán graph of order $n+1$.}
$$


The Mathematica code I used is 

    card[wrd_List] := 
      Length@Union[
        Join @@ Table[wrd[[i ;; j]], {i, Length@wrd}, {j, i, Length@wrd}]];
    h[m_, n_] := h[m, n] = Max@Table[card[w], {w, Tuples[Range[m], n]}];