Advertisement
Guest User

Immediate Circular Routes

a guest
Jan 3rd, 2021
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. pi = ''
  2.  
  3. with open('/path/to/pi_20m.txt') as the_file: pi = the_file.read()
  4.  
  5. for i in range(1, 1000000):
  6.     s = str(i)
  7.  
  8.     end_of = pi.find(s) + len(s)
  9.     end_of2 = pi.find(str(end_of)) + len(str(end_of))
  10.  
  11.     if end_of2 == i and end_of != i:
  12.         print('\n' + str(i) + ' first appears in Pi at the end of ' + str(end_of) + ' digits')
  13.         print(str(end_of) + ' first appears in Pi at the end of ' + str(end_of2) + ' digits\n')
  14.  
  15.     if i % 10000 == 0:
  16.         print('At number ' + str(i))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement