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

Home > Just Math
Consecutive-Free Sets (Posted on 2025-02-13) Difficulty: 3 of 5
Find the number of sets A such that A ⊂ {1, 2, 4, 5, 6, 8, 9, 10, 11}, |A| = 4 and A contains no consecutive integers.

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer solution | Comment 2 of 4 |
29

----
from itertools import combinations
A = [1, 2, 4, 5, 6, 8, 9, 10, 11]
count = 0
for comb in combinations(A,4):
    x = sorted(list(comb))
    fail = False
    for i in range(1,4):
        if x[i]-x[i-1] == 1:
            fail = True
    if fail:
        continue
    count += 1
print(count)

  Posted by Larry on 2025-02-13 09:26:40
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 - 2025 by Animus Pactum Consulting. All rights reserved. Privacy Information