Arrangements With 123 321 C797C6
1. **Problem Statement:** We want to find how many ways the digits of 123123123 can be arranged so that the resulting number contains the sequence 123 or the sequence 321.
2. **Understanding the problem:** The digits are 1,1,1,2,2,2,3,3,3 (three each of 1, 2, and 3). We want permutations of these digits where the substring "123" or "321" appears at least once.
3. **Total permutations without restriction:** Since there are 9 digits with repetitions, total permutations are $$\frac{9!}{3!3!3!} = \frac{362880}{6 \times 6 \times 6} = 1680.$$
4. **Define events:**
- Let $A$ be the set of permutations containing the sequence "123".
- Let $B$ be the set of permutations containing the sequence "321".
We want $|A \cup B| = |A| + |B| - |A \cap B|$.
5. **Counting $|A|$ (permutations containing "123"):** Treat the sequence "123" as a single block.
- The block "123" uses one 1, one 2, and one 3.
- Remaining digits: 1,1,2,2,3,3 (two each of 1,2,3).
- Total elements to arrange: the block + 6 remaining digits = 7 elements.
- Among these 7 elements, the digits 1,2,3 appear twice each (since one of each is in the block).
- Number of permutations: $$\frac{7!}{2!2!2!} = \frac{5040}{8} = 630.$$
6. **Counting $|B|$ (permutations containing "321"):** By symmetry, same as $|A|$:
$$|B| = 630.$$
7. **Counting $|A \cap B|$ (permutations containing both "123" and "321"):**
- Both sequences "123" and "321" appear as blocks.
- Each block uses one 1, one 2, and one 3.
- Together, they use 2 ones, 2 twos, and 2 threes.
- Remaining digits: one 1, one 2, one 3.
- Total elements to arrange: the two blocks + 3 remaining digits = 5 elements.
- The 3 remaining digits are distinct (1,2,3), so no repetition.
- Number of permutations: $$5! = 120.$$
8. **Final count:**
$$|A \cup B| = |A| + |B| - |A \cap B| = 630 + 630 - 120 = 1140.$$
**Answer:** There are 1140 such arrangements.