Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import math
- startingnumber = 0
- endnumber = 100000000
- startinterger=1
- def threealterative(number):
- string = str(number)
- length = len(string)
- for i in range (length-2):
- if (string [i] == string[i+1]) and (string [i] == string [i+2]):
- return True
- return false
- def dighitsthree(number):
- subs = [000,111,222,333,444,555,666,777,888,999]
- string = str(number)
- for sub in subs:
- if str(sub) in string:
- return true
- return false
- time = time.clock()
- for startinterger in range( 1,endnumber):
- if not threealterative(startinterger):
- startingnumber = startingnumber + (1/startinterger)
- time2 = time.clock()
- print (time.clock() - time, ' seconds ', endnumber, ' cycling')
- print (startingnumber)
- #250.32544094291302 seconds 100000000 cycling
- #18.537367351280075
- #http://www.tutorialspoint.com/python/python_date_time.htm
- #https://docs.python.org/3.0/library/time.html
- #https://pymotw.com/2/datetime/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement