Quoto

Learn / Library / Combinatorics

No equal neighbours

CombinatoricsHard

How many distinct strings use all letters of (where , and each appear times) so that no equal letters are next to each other?

Checking an answer needs JavaScript. The hint and the solution open without it.

A whole number, a decimal, a fraction like 3/8 or a percent.

Hint

Use inclusion-exclusion on which repeated letters end up adjacent; a glued pair behaves as one object.

Solution
  1. Without restrictions there are strings.
  2. Call a letter glued when its copies are adjacent. Gluing a chosen set of letters leaves objects with letters still repeated, giving strings.
  3. For this is for each of the letters, for it is for each of the choices, and for it is .
  4. By inclusion-exclusion the answer is .

Answer: