Last active
July 16, 2017 05:09
-
-
Save ijkilchenko/57e2a36ac9fe4341ead417088bbbafc8 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
from math import log10, floor | |
def r(num): | |
num_digits = floor(log10(num) + 1) | |
return num//10 + (num % 10)*(10**(num_digits-1)) | |
def does_a_divide_b(a, b): | |
if b % a == 0: | |
return True | |
else: | |
return False | |
for i in range(10, 10**10): | |
#str_i = str(i) | |
#if int(str_i[0]) > int(str_i[-1]): | |
# continue | |
r_i = r(i) | |
if does_a_divide_b(i, r_i): | |
print('%d' % i) | |
''' | |
Some output: | |
11 | |
22 | |
33 | |
44 | |
55 | |
66 | |
77 | |
88 | |
99 | |
111 | |
222 | |
333 | |
444 | |
555 | |
666 | |
777 | |
888 | |
999 | |
1111 | |
2222 | |
3333 | |
4444 | |
5555 | |
6666 | |
7777 | |
8888 | |
9999 | |
11111 | |
22222 | |
33333 | |
44444 | |
55555 | |
66666 | |
77777 | |
88888 | |
99999 | |
102564 | |
111111 | |
128205 | |
142857 | |
153846 | |
179487 | |
205128 | |
222222 | |
230769 | |
333333 | |
444444 | |
555555 | |
666666 | |
777777 | |
888888 | |
999999 | |
1111111 | |
2222222 | |
3333333 | |
4444444 | |
5555555 | |
6666666 | |
7777777 | |
8888888 | |
9999999 | |
11111111 | |
22222222 | |
33333333 | |
44444444 | |
55555555 | |
66666666 | |
77777777 | |
88888888 | |
99999999 | |
111111111 | |
222222222 | |
333333333 | |
444444444 | |
555555555 | |
666666666 | |
777777777 | |
888888888 | |
999999999 | |
1111111111 | |
2222222222 | |
3333333333 | |
4444444444 | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment