Created
May 28, 2017 08:11
-
-
Save nngogol/0ccb8db101cedf95297ab854d06a65a7 to your computer and use it in GitHub Desktop.
counting number trick (made it, because of this -> https://youtu.be/1GKfEDvhWdY)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def count_nums(n): | |
result = dict() | |
result[0] = 0 | |
result[1] = 0 | |
result[2] = 0 | |
result[3] = 0 | |
result[4] = 0 | |
result[5] = 0 | |
result[6] = 0 | |
result[7] = 0 | |
result[8] = 0 | |
result[9] = 0 | |
numbers = str(n) | |
for num in numbers: | |
result[int(num)] = numbers.count(num) | |
return result | |
import time | |
start = time.time() | |
countt_ea = time.time() | |
for i in range(6209000995,6210001003): | |
test_item = count_nums(i) # { 0: 6, | |
# 1: 2, | |
# 2: 1, | |
# 3: 0, | |
# 4: 0, | |
# 5: 1, | |
# 6: 0, | |
# 7: 0, | |
# 8: 0, | |
# 9: 0 } | |
# apeenden = ''.join([ str(symbol) for symbol in test_item.values() ]) | |
apeenden = '' | |
for j in range(0,10): | |
apeenden += str(test_item[j]) | |
if i % 60000 == 0: | |
print(str(i) + 'is now cheaking...') | |
print('TIME :', time.time() - start) | |
print('TIME (from previus) :', time.time() - countt_ea) | |
countt_ea = time.time() | |
if int(apeenden) == i: | |
print("YESSSSSsssssssssss") | |
print(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
22 sec on my machine 🥇
Post your results here :D