Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import combinations, chain
- allsubsets = lambda n: list(chain(*[combinations(range(n), ni) for ni in range(n+1)]))
- print "Creating subsets..."
- a = allsubsets(22)
- # Example output [(), (0,), (1,), (2,), (0, 1), (0, 2), (1, 2), (0, 1, 2)]
- list3 = [3, 4, 9, 14, 15, 19, 28, 37, 47, 50, 54, 56, 59, 61, 70, 73, 78, 81, 92, 95, 97, 99]
- count = 0 # Used to filter out the first blank subset
- count1 = 0 # Used for the sum of the numbers in each subset
- result1 = 0 # When subsets
- for b in a:
- if len(b) == 8: # After len(subset) = 8 there are no possible further matches
- print "The Third Password is :", result1
- break
- if count == 0: count += 1 # Filter out the first blank subset
- else:
- if len(b) > 1: # Filter out subsets with one number in them
- count1 = 0
- for c in b: count1 += int(list3[c])
- if count1 in list3: result1 = int(result1 + 1)
Advertisement
Add Comment
Please, Sign In to add comment