All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Chatty Classmates (Posted on 2024-07-29) Difficulty: 3 of 5
Mrs Green is teaching a class of eight students, which she knows consists of four pairs of “Best Friends”. She needs to divide them into pairs for an activity, but she also knows that if she puts any pair of best friends together then they will chat all lesson and get no work done.

How many ways can she put them into productive pairs?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Different answer | Comment 2 of 3 |
Label the students as follows, with adjacent letters being best friends:
AB PQ MN XY

There are 6 options for A to pair with, and then 5 options for B.
A_ 6 ways
B_ 5 ways
At this point, there are 2 ways to sort out the remaining 4.  And this is true whether or not A's partner is best friends with B's partner.
So, 6*5*2 = 60

Confirmed with the following program.  I turned the students into integers with best friends designated by values differing by 1.

----------
def reorder(alist):
    """  take a list, sort into sorted list of sorted pairs """
    if len(alist)%2 == 1:
        return 'list must have an even number of elements'
    newlist = []
    for i in range(0,len(alist),2):
        newlist.append(sorted(list(alist[i:i+2])))
    return sorted(newlist)
        
students = [1,2,4,5,7,8,10,11]
from itertools import permutations

count = 0
theways = []
for p in permutations(students):
    fail = False
    x = reorder(p)
    for pair in x:
        if pair[1] - pair[0] == 1:
            fail = True
    if not fail:
        if x not in theways:
            theways.append(x)
            count += 1
            print(x)
print(count)

Output:
[[1, 4], [2, 5], [7, 10], [8, 11]]
[[1, 4], [2, 5], [7, 11], [8, 10]]
[[1, 4], [2, 7], [5, 10], [8, 11]]
[[1, 4], [2, 7], [5, 11], [8, 10]]
[[1, 4], [2, 8], [5, 10], [7, 11]]
[[1, 4], [2, 8], [5, 11], [7, 10]]
[[1, 4], [2, 10], [5, 7], [8, 11]]
[[1, 4], [2, 10], [5, 8], [7, 11]]
[[1, 4], [2, 11], [5, 7], [8, 10]]
[[1, 4], [2, 11], [5, 8], [7, 10]]
[[1, 5], [2, 4], [7, 10], [8, 11]]
[[1, 5], [2, 4], [7, 11], [8, 10]]
[[1, 5], [2, 7], [4, 10], [8, 11]]
[[1, 5], [2, 7], [4, 11], [8, 10]]
[[1, 5], [2, 8], [4, 10], [7, 11]]
[[1, 5], [2, 8], [4, 11], [7, 10]]
[[1, 5], [2, 10], [4, 7], [8, 11]]
[[1, 5], [2, 10], [4, 8], [7, 11]]
[[1, 5], [2, 11], [4, 7], [8, 10]]
[[1, 5], [2, 11], [4, 8], [7, 10]]
[[1, 7], [2, 4], [5, 10], [8, 11]]
[[1, 7], [2, 4], [5, 11], [8, 10]]
[[1, 7], [2, 5], [4, 10], [8, 11]]
[[1, 7], [2, 5], [4, 11], [8, 10]]
[[1, 7], [2, 8], [4, 10], [5, 11]]
[[1, 7], [2, 8], [4, 11], [5, 10]]
[[1, 7], [2, 10], [4, 8], [5, 11]]
[[1, 7], [2, 10], [4, 11], [5, 8]]
[[1, 7], [2, 11], [4, 8], [5, 10]]
[[1, 7], [2, 11], [4, 10], [5, 8]]
[[1, 8], [2, 4], [5, 10], [7, 11]]
[[1, 8], [2, 4], [5, 11], [7, 10]]
[[1, 8], [2, 5], [4, 10], [7, 11]]
[[1, 8], [2, 5], [4, 11], [7, 10]]
[[1, 8], [2, 7], [4, 10], [5, 11]]
[[1, 8], [2, 7], [4, 11], [5, 10]]
[[1, 8], [2, 10], [4, 7], [5, 11]]
[[1, 8], [2, 10], [4, 11], [5, 7]]
[[1, 8], [2, 11], [4, 7], [5, 10]]
[[1, 8], [2, 11], [4, 10], [5, 7]]
[[1, 10], [2, 4], [5, 7], [8, 11]]
[[1, 10], [2, 4], [5, 8], [7, 11]]
[[1, 10], [2, 5], [4, 7], [8, 11]]
[[1, 10], [2, 5], [4, 8], [7, 11]]
[[1, 10], [2, 7], [4, 8], [5, 11]]
[[1, 10], [2, 7], [4, 11], [5, 8]]
[[1, 10], [2, 8], [4, 7], [5, 11]]
[[1, 10], [2, 8], [4, 11], [5, 7]]
[[1, 10], [2, 11], [4, 7], [5, 8]]
[[1, 10], [2, 11], [4, 8], [5, 7]]
[[1, 11], [2, 4], [5, 7], [8, 10]]
[[1, 11], [2, 4], [5, 8], [7, 10]]
[[1, 11], [2, 5], [4, 7], [8, 10]]
[[1, 11], [2, 5], [4, 8], [7, 10]]
[[1, 11], [2, 7], [4, 8], [5, 10]]
[[1, 11], [2, 7], [4, 10], [5, 8]]
[[1, 11], [2, 8], [4, 7], [5, 10]]
[[1, 11], [2, 8], [4, 10], [5, 7]]
[[1, 11], [2, 10], [4, 7], [5, 8]]
[[1, 11], [2, 10], [4, 8], [5, 7]]
60

  Posted by Larry on 2024-07-29 10:48:47
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information