String Hashing

see the problem 4 in above link
can Anyone explain how primes should be choosen to match anagrams