Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # base_N_by_L.py
- def base2index(combo):
- i = combo[-1]
- c = combo[:-1]
- for k,v in enumerate(c[::-1]):
- i += int(v * base ** (k + 1))
- return i
- def index2base(n):
- results = []
- for z in '.' * baselength:
- results.append(int(n % base))
- n //= base
- return list(reversed(results))
- base = 12
- baselength = 12
- i = base2index([base-1 for i in '.' * baselength])
- print i
- while 1:
- aaa = index2base(i)
- bbb = base2index(aaa)
- print 'from '+str(bbb).zfill(16), 'to', aaa
- print '.....'+str(i).zfill(16)
- print
- i -= 1
- 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement