We need to count the number of 6-digit sequences where exactly one pair of consecutive digits is equal, and all other adjacent digits are different.

We need to count the number of 6-digit sequences where exactly one pair of consecutive digits is equal, and all other adjacent digits are different.

["Title: Counting 6-Digit Sequences with Exactly One Pair of Consecutive Equal Digits – A Combinatorial Challenge", "---", "Introduction", "In the world of combinatorics and string pattern analysis, counting specific digit patterns in sequences is both a fundamental and fascinating problem. One particularly engaging challenge involves 6-digit sequences (from 100000 to 999999) where exactly one pair of consecutive digits is equal, and all other adjacent digit pairs are distinct. This article explores the structured approach to solving such counting problems, breaking down constraints, applying combinatorics, and delivering a precise count of valid sequences.", "---", "Problem Statement", "We need to count how many 6-digit sequences satisfy the following conditions:", "1. Only one pair of consecutive digits is equal (i.e., two adjacent digits are the same, say (d_idx = d_{idx+1})),\n2. All other adjacent digits (i.e., (d_i <br/>\ne d_{i+1}) for (i <br/>\ne idx)) are different,\n3. The sequence is a valid 6-digit number (starts from 100000, no leading zeros).", "---", "Understanding the Structure", "A valid sequence has digits (d_1d_2d_3d_4d_5d_6), with exactly one place (i) (from 1 to 5) where (d_i = d_{i+1}), and all adjacent pairs (d_j <br/>\ne d_{j+1}) for (j <br/>\ne i).", "We count how many such sequences exist under the rules above.", "---", "Step-by-step Solution", "### Step 1: Choose the position of the repeated pair", "The equal pair can occur at one of the five adjacent positions: between (d_1–d_2), (d_2–d_3), (d_3–d_4), (d_4–d_5), or (d_5–d_6). So, there are 5 possible positions where the single repeat occurs.", "Let the repeated digit pair appear at position (i), i.e., (d_i = d_{i+1} = a), where (a \in {0,1,2,…,9}) but note: if (i = 1) and (a = 0), (d_1 = 0) would make it not a valid 6-digit number. So we must be careful with (i = 1).", "We analyze each case with this constraint.", "---", "### Step 2: Handle the leading digit constraint", "Since the number cannot start with zero,\n- For repetition at position 1 ((d_1 = d_2 = a)): (a <br/>\ne 0)\n- For other positions ((i \ge 2)): (a) can be any digit 0–9, but the digit at (d_1) can be 0 as long as no leading zero—so (a) allowed from 1 to 9, or 0 to 9 otherwise, except that position.", "We therefore separate cases based on whether the repeated pair is at:", "- Case A: (i = 1) — repeated pair at start\n- Case B: (i = 2,3,4,5) — repeated pair elsewhere", "---", "### Step 3: Case Analysis", "Let’s define the general structure.", "For each possible (i \in {1,2,3,4,5}), define:", "- (d_i = d_{i+1} = a), with (a \in {0,1,…,9}) but subject to digit continuity and no leading zero.", "We count the number of valid sequences for each (i), then sum.", "---", "#### Case A: Repeated pair at (i=1) (positions (d_1 = d_2 = a))", "- (a <br/>\ne 0), so 9 choices: (a = 1) to (9)\n- For each (a), (d_1 = d_2 = a)\n- Now enforce: (d_2 <br/>\ne d_3), (d_3 <br/>\ne d_4), (d_4 <br/>\ne d_5), (d_5 <br/>\ne d_6)\n- So (d_3 <br/>\ne a), (d_4 <br/>\ne d_3), (d_5 <br/>\ne d_4), (d_6 <br/>\ne d_5)\n- Each digit from (d_3) to (d_6) must differ from the prior digit", "Let's count valid completions for fixed (a):", "- (d_3): 9 choices (0–9 except (a))\n- (d_4): 9 choices (0–9 except (d_3))\n- (d_5): 9 choices (0–9 except (d_4))\n- (d_6): 9 choices (0–9 except (d_5))", "But wait — is that valid? Actually, after restriction, each digit after (d_2) only excludes its immediate predecessor, and digits can repeat with earlier ones as long as adjacent ones are unequal. This is exactly the number of sequences of length 4 with adjacent distinct digits, starting from 9 options (not equal to (a)).", "So for (d_3 d_4 d_5 d_6): a 4-digit string with adjacent digits all different, and (d_3 <br/>\ne a).", "But the digit restrictions are:", "- (d_3 \in {0,…,9} \setminus {a}) → 9 choices\n- (d_4 \in {0,…,9} \setminus {d_3}) → 9 choices\n- (d_5 \in {0,…,9} \setminus {d_4}) → 9 choices\n- (d_6 \in {0,…,9} \setminus {d_5}) → 9 choices", "So total for each (a <br/>\ne 0): (9^4 = 6561) sequences", "Total for Case A: (9 \ imes 6561 = 59049)", "---", "#### Case B: Repeated pair at (i = 2,3,4,5)", "Fix repetition at position (i), (2 \le i \le 5), so (d_i = d_{i+1} = a), with constraints:", "- No leading zero: (d_1 <br/>\ne 0)\n- All adjacent pairs unequal\n- Exactly one repeated pair (so prior and next transitions must differ)", "We break into subcases based on (i), but note symmetry: (i=2) and (i=4) behave similarly, (i=3) is central. Let’s handle each.", "---", "##### Subcase B1: (i = 2) → (d_2 = d_3 = a)", "Structure:\n- (d_1 <br/>\ne 0), (d_1 <br/>\ne a) (since (d_1 <br/>\ne d_2))\n- (d_2 = a), (d_3 = a)\n- (d_3 <br/>\ne d_4) → (d_4 <br/>\ne a)\n- (d_4 <br/>\ne d_5), (d_5 <br/>\ne d_6)", "Count:", "- Choose (a): 10 choices ((0) to (9))\n- Choose (d_1): must ≠ 0 and ≠ (a) → if (a = 0), then (d_1) has 9 choices (1–9); if (a <br/>\ne 0), 8 choices (0–9 except (a), but (d_1 <br/>\ne 0))\n → Better: total = (9 + 9 \ imes 9 = 9) (for (a=0)) + (9 \ imes 8 = 72) (for (a=1..9))? Wait — more cleanly:", "- If (a = 0): (d_1) ≠ 0 and ≠ 0 → just ≠ 0 → 9 choices\n- If (a = 1..9): (d_1) ≠ 0 and ≠ (a) → so 8 choices (excluding 0 and (a))\n→ So total (d_1): (1 \ imes 9 + 9 \ imes 8 = 9 + 72 = 81) choices", "Now:", "- (d_4 <br/>\ne a): 9 choices\n- (d_5 <br/>\ne d_4): 9 choices\n- (d_6 <br/>\ne d_5): 9 choices", "So for each (a), valid sequences: (81 \ imes 9 \ imes 9 \ imes 9 = 81 \ imes 729 = 59049)", "But wait — is this correct?", "Wait: after (d_3 = a), we pick (d_4 <br/>\ne a): 9 choices\nThen (d_5 <br/>\ne d_4): 9 choices (≠ (d_4)), not necessarily ≠ (a) unless forced — but only restriction is (d_5 <br/>\ne d_4), so yes 9\nSimilarly (d_6 <br/>\ne d_5): 9", "So product: (9 \ imes 9 \ imes 9 = 729) for (d_4 d_5 d_6), multiplied by (d_1) choices (81) → 59049 per (a)", "But for each (a), this holds. So total for (i=2):\nSum over (a = 0) to (9):", "- At (a=0): (d_1 = 9) choices → total: (9 \ imes 729 = 6561)\n- At (a=1) to (9): (d_1 = 81) choices? Wait earlier: for each nonzero (a), (d_1 <br/>\ne 0, a) → 8 choices → total (8 \ imes 729 = 5832)\nWait — miscalculation.", "Actually:", "- For each fixed (a):\n - (d_1): number of allowed digits = (10 - 2 = 8) if (a <br/>\ne 0); but if (a = 0), (d_1 <br/>\ne 0) → 9 choices\n So total (d_1): (1 \ imes 9 + 9 \ imes 8 = 9 + 72 = 81) (as before)\n- For each (a), (d_4 d_5 d_6): 9 (d₄) × 9 (d₅) × 9 (d₆) = 729", "So total for fixed (a): (81 \ imes 729 = 59049)", "Now sum over (a = 0) to (9):", "- (a = 0): 59049\n- (a = 1–9): 9 values × 59049 = (9 \ imes 59049 = 531441)\nTotal for Case B1: (59049 + 531441 = 590490)", "Wait — this is wrong, because for each (a), the count is independent — we’re summing over (a), each with 59049 options. But that would be enormous — over 550k per (a)? No — for each (a), number of valid sequences is:", "(d_1) (81 choices) × 9 (d₄) × 9 (d₅) × 9 (d₆) = (81 \ imes 729 = 59049)", "Yes — and for each (a), this is valid. So total:", "Sum over (a=0) to (9):", "- (a=0): 59049\n- (a=1..9): 9 × 59049 = 531441\nTotal = (59049 + 531441 = 590490)", "Same as previous case.", "Interesting — symmetric.", "But wait: does this account for overlap? No — we’re counting per (a), and (a) is fixed per branch. So total Case B: (590490)", "But this is much larger than Case A — but let’s continue.", "Wait — but we must avoid overcounting? No, each case is distinct: (i=2), (i=3), (i=4), (i=5), and digit values different, so no overlap.", "---", "##### Subcase B2: (i = 3) → (d_3 = d_4 = a)", "Structure:\n- Must have (d_2 <br/>\ne a), (d_4 <br/>\ne a), (d_4 <br/>\ne d_5)\n- (d_1 <br/>\ne d_2), (d_5 <br/>\ne d_6)", "Count:", "- Choose (a): 10 choices\n- (d_2 <br/>\ne a), (d_1 <br/>\ne d_2): similar to (i=2):\n (d_2 ≠ a) and (≠ 0) if (a=0)? No — only (d_1 ≠ 0), (d_2) only restricted by (d_1 <br/>\ne d_2)\n So:\n - If (a = 0): (d_2 ≠ 0) and (d_2 ≠ a = 0) → same → 9 choices ((d_2 ≠ 0))\n - If (a ≠ 0): (d_2 ≠ a) and (≠ 0) → 8 choices\n So (d_2): 9 (for (a=0)) + 9×8 = 72 → total (81) choices\n- (d_4 = a), (d_4 ≠ d_3 = a) → already enforced\n- (d_5 ≠ a)\n- (d_5 ≠ d_4 = a), so same as (d_2 <br/>\ne a) → 9 choices for (d_5)\n- (d_6 ≠ d_5) → 9 choices", "Same structure as (i=2): number of sequences:\n(81 \ imes 9 \ imes 9 \ imes 9 = 59049) per (a)\nSum over (a): same as above → 590490", "---", "##### Subcase B3: (i = 4) → (d_4 = d_5 = a)\nSymmetric to (i=2) and ("]

Related Articles

Trending Articles