Weekend combinatorics (II)

25 Nov, 2022 at 13:31 | Posted in Varia | 7 Comments

How many permutations exist of the ten digits (0-9) that either begin with”123″, contain “56” in the 6th & 7th positions, or end with “789”?

7 Comments

  1. A + B + C – AnB – AnC – BnC – 2*AnBnC
    = 7! + 8! + 7! – 5! – 4! – 5! – 2*2!
    = 49932

    • Almost, but not quite. If you do the arithmetic right and think again about the last part (-2*AnBnC) you will get the right answer — 50138 🙂

      • A + B + C – AnB – AnC – BnC + AnBnC
        = 7! + 8! + 7! – 5! – 4! – 5! + 2!
        = 50138

        • Spot on 🙂

        • How long would it take you to actually generate them, compared to my program?

          • I guess something like 10 times more (at least if we include some of the programming time) 🙂
            But I still think it’s nice to know that you can sit down with just a pencil and paper and solve things …

  2. Assuming no repetitions and “1234056789” is counted only once, 50138?
    .
    https://subbot.org/misc/perms.rb.txt


Sorry, the comment form is closed at this time.

Blog at WordPress.com.
Entries and Comments feeds.