Sets of symbols contained in contiguous substrings Let $\Sigma$ be an alphabet with $m$ different symbols.
Let $s$ be a string in $\Sigma$ of length $n$. Assume that every symbol in $\Sigma$ occurs in $s$ at least once (so $n\geq m$).
Let $\mathrm{Sub}(s)$ be the set of contiguous substrings of $s$. Let $P(\Sigma)$ be the power set of $\Sigma$. There is a map $f:\mathrm{Sub}(s)\to P(\Sigma)$ sending a substring to the set of symbols it contains.
For fixed $m$ and $n$ what is the maximum cardinality of the image of $\mathrm{Sub}(s)\to P(\Sigma)$?
For instance if $m=n$ then $f$ is injective so we get$$1+\frac{n(n+1)}{2}$$different subsets.
 A: 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}
 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 \\
 2 & 4 & 4 & 4 & 4 & 4 & 4 & 4 \\
 2 & 4 & 7 & 8 & 8 & 8 & 8 & 8 \\
 2 & 4 & 7 & 11 & 13 & 14 & 15 & 16 \\
 2 & 4 & 7 & 11 & 16 & 19 & 21 & 23 \\
 2 & 4 & 7 & 11 & 16 & 22 & 26 & 29 \\
\end{array}
$$
The code used here is:
cardSort[wrd_List] := Prepend[
   Union[Join @@ Table[
      Union[wrd[[i ;; j]]],
      {i, Length@wrd}, {j, i, Length@wrd}]]
   , {}];
h2[m_, n_] := 
  h2[m, n] = Max@Table[Length@cardSort[w], {w, Tuples[Range[m], n]}];

OLD Answer:
If we instead set
$$
 h'(m,n) = \max_{f : [n] \to [m] } | \mathrm{image}(f) |.
$$
where the we now map to $f$ to  the set of all contiguous substrings,
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}
$$
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 here 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]}];

