Basically, Anagrams are like permutation of string.E.g stack
,sackt
,stakc
all are anagrams of stack
(thought above words
The obvious solution is to map each character to a prime number and multiply the prime numbers. So if 'a'' -> 2 and 'b' -> 3, then
To minimise the chance of overflow, the smallest primes could be assigned to the more frequent letters (e,t,i,a,n). Note: The 26th prime is 101.
UPDATE: an implementation can be found here