Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # constrained_binaries.py
- aaa = 3
- bbb = ['0001111000' * aaa] #
- ttt = {}
- print ('...')
- while bbb:
- b = bbb.pop()
- ttt[b] = []
- zzz = []
- # print (b)
- while 1:
- step = 0
- for s in ('10','01'):
- iii = 0
- while s in b[iii:]:
- if b.count('1') < aaa*6.3:
- i = b[iii:].index(s)+1
- t = b[:iii]+b[iii:].replace(s,'11',1)
- if t not in zzz:
- step = 1
- zzz += [t]
- # zzz += [t[::-1]] # to avoid mirrors
- bbb += [t]
- ttt[b] += [t]
- iii += i
- else:
- break
- if not step:
- break
- print (len(ttt))
Add Comment
Please, Sign In to add comment