Consider a set of words where you want to divide the set into subsets of words, where all members of each subset are anagrams (same letters, different arrangement). You can do this computationally in several ways, the "best" way is sorting the letters from A through Z in each word. If two words are equal when their respective letters are sorted, then they must be anagrams. Otherwise, they are not. For the general case we cannot do any better. The sorting, which is $\mathcal{O}(M \log M)$ for each word of length $M$, is the computationally hardest part.
But here is something I've been discussing. Suppose we know there is a longest word with $M$ characters. Then imagine we have a so-called "hash function" $f$ which maps a word to a positive integer. Let each letter A,B,C,...,Z have a specific weight $a_1,a_2,a_3,\dots,a_{26}$. For a word $x$, the value $f(x)$ is the sum of the corresponding weights without regard to their position within the word. $f(ZABC) = a_{26} + a_1 + a_2 + a_3$. This has linear complexity, $\mathcal{O}(M)$ for each word.
If we can select these weights such that only words that are anagrams map to the same value, then a computer can easily calculate whether two words are anagrams by looking at their respective function value. The question is of course, how do we choose the weights?
I can formulate the problem as such:
For fixed $M$ and $N$, find $\{a_1,a_2,\dots,a_{N}\}$, where $a_1 < a_2 < \dots < a_{N}$, such that $$c_ia_i \neq c_1a_1 + c_2a_2 + \dots + c_{i-1}a_{i-1} + c_{i+1}a_{i+1} + \dots + c_{N}a_{N}$$ for any combination of $c_j \in \{0,1,2,\dots,M\}$ except $c_1=c_2=\dots=c_{N}=0$.
Basically, we want to find a linearly independent $N$-subset of $\Bbb Z_{>0}$ subject to a constraint on the coefficients. Is there a clever method for this?
A very simple solution is to let $a_1 = 1$ and recursively define $a_{i+1} = Ma_i + 1$ but this grows very quickly and $a_{26}$ is too large for use in computers. For small $M$ and $N$ I have been able to find better solutions.
Is there a better solution for $N=26$ and say $M \approx 15$? What is the smallest possible $a_{26}$?