Advertisement
Klokova_Sofi

Untitled

Feb 8th, 2022
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. n = 325396
  2. b = [2, 0] * (n + 1)
  3. b[2] = 0
  4. d = 0
  5. y = len(b)
  6. #0 - простое
  7.  
  8. def f():
  9. for i in range(3, round(325396.0 ** 0.5) + 1, 2):
  10. if b[i] == 0:
  11. for j in range(2*i, y, i):
  12. b[j] = i
  13.  
  14. #236228; 305283
  15.  
  16. f()
  17. for i in range(278932, 325396):
  18. k = 0
  19. a = i
  20. sch = 0
  21. if b[a] != 0:
  22. c = b[a] % 10
  23. a = a // b[a]
  24. if b[a] != 0 and c == b[a] % 10:
  25. a = a // b[a]
  26. if b[a] == 0 and c == a % 10:
  27. d = d + 1
  28.  
  29. # while b[a] != 0 and sch != 1:
  30. # a = a // b[a]
  31. # sch = sch + 1
  32. # if c != b[a] % 10:
  33. # k = 1
  34. # if b[a] == 0 and sch == 1 and c == b[a] % 10 and k == 0:
  35. # d = d + 1
  36.  
  37. print(d)
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement