Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. #coding: cp1251
  2. def delimost(x):
  3.     temp = str(x)
  4.     res = 0
  5.     if int(temp[-2:0]) % 2 == 0:
  6.         res += 1
  7.     if temp[-1] == 5 or 0:
  8.         res += 1
  9.     if (x - (int(temp[-1]) * 2)) % 7 == 0:
  10.         res += 1
  11.     if temp[-1] == 0 and int(temp[-2:-1]) % 2 == 0:
  12.         res += 1
  13.     tmp1, tmp2 = temp[::2], temp[1::2]
  14.     if int(tmp1) == int(tmp2) or abs(int(tmp1) - int(tmp2)) % 11 == 0:
  15.         res += 1
  16.     tmp1 = int(temp[:-1])
  17.     tmp2 = int(temp[-1] * 4)
  18.     if tmp1 + tmp2 % 13 == 0:
  19.         res += 1
  20.     tmp1 = int(temp[-2:-1])
  21.     tmp2 = int(temp[-1] * 5)
  22.     if (tmp1 - tmp2) % 17 == 0:
  23.         res += 1
  24.     tmp1 = int(temp[-2:-1])
  25.     tmp2 = int(temp[-1] * 2)
  26.     if (tmp1 + tmp2) % 19 == 0:
  27.         res += 1
  28.     if temp[-1] == 0 and int(temp[-2:-1]) % 2 == 0:
  29.         res += 1
  30.     if res == 9:
  31.         return True
  32.     else:
  33.         return False
  34.  
  35. t = 20
  36. while t:
  37.     if delimost(t) == True:
  38.         t = False
  39.         print t
  40.     else:
  41.         t += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement