Guest User

Self Locate

a guest
Oct 15th, 2020
231
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pi = ''
  2.  
  3. with open('/path/to/pi.txt') as the_file: pi = the_file.read()      # This file should start without "3." in the front
  4.  
  5. for n in range(1, 8):
  6.     for i in range(0, len(pi)):
  7.         end_of = i + n
  8.         num = pi[i:end_of]
  9.  
  10.         if num == str(end_of):
  11.             print(num)
  12.  
  13.         if end_of > num: break
  14.  
  15. """
  16. Pi:     (1), (315), 360, 384, (1045794)
  17.  
  18. Phi:        8, (20), 62, (466), (4854), 46914, 48949
  19.  
  20. e:          62, (3999), 340616, (350954), (776064), (1382603), (1898195)
  21.  
  22. 2Pi:        (3), 79, (470), 816, 62180, 92253, (1493476)
  23. """
RAW Paste Data