2

I saw many questions about anagrams here, but neither one fits my needs.

Let's say we have the word MISSISSIPPI. I need to find the count for those anagrams that meet the criterias as follows:

  1. Unique anagrams, of course;
  2. No substring of 3 letters from the word MISSISSIPPI are allowed in the count for "accepted" anagrams, regardless of their position;

Explanation of statement #2: In the result set are not allowed words containing the following substrings of 3 letters: [MIS], [ISS], [SSI], [SIS], [ISS], [SSI], [SIP], [IPP], [PPI].

As we see, there are two identical substrings 2x[ISS] and 2x[SSI].

So if I have the following anagram xMISxxxxxxx - it does not count as accepted anagram, neither does SIPxxxxxxxx, and so on.

Is there a way to find the correct answer with pure combinatorics?

  • You announce that you'll give an example -- but it seems that what follows is a complete enumeration of the excluded substrings? Or are there any others? – joriki Aug 11 '15 at 13:28
  • joriki: no there's no other substrings, i have enumerated all of them to exclude any possibility of missinterpretation of a "substring" – Himself73 Aug 11 '15 at 13:40
  • Then I'd suggest not to call this "giving an example", which is also prone to misinterpretation. – joriki Aug 11 '15 at 13:41
  • I have edited the question. Hope it's OK now. – Himself73 Aug 11 '15 at 13:45
  • A computer can do it in less than a second. would you accept the code as an answer? – Asinomás Aug 11 '15 at 13:45
  • If there's no way to find a solution in pure combinatorics, then of course, code is the answer. – Himself73 Aug 11 '15 at 13:48
  • 1
    You could do it using inclusion-exclusion, but it would be quite a hassle. – joriki Aug 11 '15 at 14:00
  • I don't think there's a simpler way than inclusion-exclusion, but a computer would do it very fast. – Colm Bhandal Aug 11 '15 at 14:51
  • You could use the Goulden-Jackson cluster method. This allows you to enumerate words that avoid any collection of substrings. This loses a lot of the structure of the problem, though, since you would just use the substrings MIS, ISS, etc. and forgetting where they come from. It would also get hairy pretty quickly if the word length $n$ was long as it would solving $n \times n$ systems of equations. – Jair Taylor Aug 13 '15 at 18:26

0 Answers0