Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- POPULAR = []
- for i in range(10):
- POPULAR.append(str(i) * 4)
- if (i + 3) < 10:
- POPULAR.append(str(i) + str(i + 1) + str(i + 2) + str(i + 3))
- POPULAR.append(str(i + 3) + str(i + 2) + str(i + 1) + str(i))
- for i in range(1900, 2018):
- POPULAR.append(i)
- days = [i for i in range(1, 32)]
- months = [i for i in range(1, 13)]
- for d in days:
- d = str(d)
- if len(d) == 1:
- d = '0' + d
- for m in months:
- m = str(m)
- if len(m) == 1:
- m = '0' + m
- POPULAR.append(d + m)
- POPULAR.append(m + d)
- POPULAR = [int(i) for i in POPULAR]
- # Let's remove doubles
- CLEAN_POPULAR = []
- for i in POPULAR:
- if i not in CLEAN_POPULAR:
- CLEAN_POPULAR.append(i)
- def autist(number):
- count = 0
- while count <= 9999:
- count += 1
- if number == count:
- return count
- def hacker(number):
- count = 0
- for i in CLEAN_POPULAR:
- count += 1
- if i == number:
- return count
- for i in range(5001):
- if i not in CLEAN_POPULAR:
- count += 1
- if i == number:
- return count
- i = 9999 - i
- if i not in CLEAN_POPULAR:
- count += 1
- if i == number:
- return count
- def mathematician(number):
- count = 0
- for i_init in range(5001):
- count += 1
- if i_init == number:
- return count
- i = 9999 - i_init
- count += 1
- if i == number:
- return count
- i = 5000 - i_init
- count += 1
- if i == number:
- return count
- i = 5000 + i_init
- count += 1
- if i == number:
- return count
- minimum = 0
- result = {}
- for i in range(1, 10000):
- min_autist = autist(i)
- min_hacker = hacker(i)
- min_mathematician = mathematician(i)
- new_minimum = min(min_autist, min_hacker, min_mathematician)
- if new_minimum > minimum:
- minimum = new_minimum
- result = {
- 'number': i,
- 'autist': min_autist,
- 'hacker': min_hacker,
- 'mathematician': min_mathematician,
- }
- print result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement