I am from math.stackexchange, here is my original post.
The only comment I received was too technical for me, so I've decided to repost here in hope of a more mathematician friendly answer. Thanks in advance!
A while back I realised that I could find all anagrams in a language by assigning each letter to a prime number (I call this prime coding, though it probably has a proper name) then multiply the letters in a word to create some value. Then words that are anagrams will have the same value.
for example, if we let: $$a=2, \;\; b=3, \;\; c=5, \;\; d=7, \;\; \cdots , \;\; t=71, \;\; \cdots$$ then $cat = 2\times 5 \times 71$ and $tac = 71 \times 2 \times 5$
Due to the fundamental theorem of arithmetic two words will have the same value if and only if they are anagrams.
When I thought about this practically, the numbers started getting pretty big. A 10 letter word is likely to be over 1 trillion. In an attempt to reduce these values I turned to Gaussian Integers. So that I could use smaller numbers as my primes.
- Are there any more types of prime numbers I could use to further reduce values?
I suspect Quarternions and Octonians(?) and further powers of 2 down that route could potentially reduce the value at a cost of the number of numbers needed. So presumably there would be an optimal pay off here. But I'm more interested in a different approach.
Thank you in advance