Last active
July 7, 2017 16:54
-
-
Save Tethik/89cbace5b98c970947b580ec1202f43d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
magic_numbers = [0,1,2,3,0.1,0.2,0.3,1.1,1.2,1.3,2.1,2.2,2.3,3.1,3.2,3.3] | |
results = dict() | |
for x in range(10): | |
# multiply | |
results[x] = set([round(x*m) for m in magic_numbers]) | |
results[x] |= set([int(x*m) for m in magic_numbers]) | |
# divide | |
results[x] |= set([round(x/m) for m in magic_numbers[1:]]) | |
results[x] |= set([int(x/m) for m in magic_numbers[1:]]) | |
# subtract | |
results[x] |= set([round(x-m) for m in magic_numbers]) | |
results[x] |= set([int(x-m) for m in magic_numbers]) | |
# add | |
results[x] |= set([round(x+m) for m in magic_numbers]) | |
results[x] |= set([int(x+m) for m in magic_numbers]) | |
# modulo | |
results[x] |= set([round(x % m) for m in magic_numbers[1:4]]) | |
results[x] |= set([int(x % m) for m in magic_numbers[1:4]]) | |
print("Numbers that can follow a given digit.") | |
for x in range(10): | |
print(x, sorted([r for r in results[x] if r < 10])) | |
print() | |
print("Numbers that cannot follow a given digit.") | |
for x in range(10): | |
print(x, [d for d in range(10) if d not in [r for r in results[x] if r < 10]]) | |
""" | |
Numbers that can follow a given digit. | |
0 [-3, -2, -1, 0, 1, 2, 3] | |
1 [-2, -1, 0, 1, 2, 3, 4, 5] | |
2 [-1, 0, 1, 2, 3, 4, 5, 6, 7] | |
3 [0, 1, 2, 3, 4, 5, 6, 7, 9] | |
4 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
5 [0, 1, 2, 3, 4, 5, 6, 7, 8] | |
6 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
7 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
8 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
9 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
Numbers that cannot follow a given digit. | |
0 [4, 5, 6, 7, 8, 9] | |
1 [6, 7, 8, 9] | |
2 [8, 9] | |
3 [8] | |
4 [] | |
5 [9] | |
6 [] | |
7 [] | |
8 [] | |
9 [] | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment