Advertisement
Guest User

Constant Digit Scanning

a guest
Jan 3rd, 2021
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. # python3 '/path/to/Constant_Digit_Scanning.py'
  2.  
  3. data = ''
  4.  
  5. with open('/path/to/constant.txt') as the_file: data = the_file.read()
  6.  
  7. for n in range(1, 15):
  8.     tried = set()
  9.  
  10.     for i in range(0, len(data)):
  11.         num = data[i:i + n]
  12.  
  13.         if len(num) != n: exit()        # Program has run to the end of the constant
  14.  
  15.         if num not in tried:
  16.             tried.add(num)
  17.  
  18.         if len(tried) == 10 ** n:
  19.             print(num)
  20.             break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement