Advertisement
Korotkodul

dem22.n25

Jun 18th, 2023
568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. import math
  2. def f(n):
  3.     div = []
  4.     for d in range(2, math.ceil(n ** 0.5) + 1):
  5.         if n % d == 0:
  6.             div.append(d)
  7.     if len(div) == 0:
  8.         return 0
  9.     M = div[0] + div[-1]
  10.     return M
  11.  
  12. def get(n):
  13.     div = []
  14.     for d in range(2, math.ceil(n ** 0.5) + 1):
  15.         if n % d == 0:
  16.             div.append(d)
  17.     print(div)
  18.  
  19. n = 700000
  20. k = 0
  21. """
  22. 700004 558
  23. [2, 4, 139, 278, 556]
  24. """
  25.  
  26.  
  27. while k < 5:
  28.     n += 1
  29.     M = f(n)
  30.     if str(M)[-1] == '8':
  31.         print(n, M)
  32.         #get(n)
  33.         #print()
  34.         k += 1
  35. #t = 556
  36. #print(700004 % t)
  37.  
  38. """
  39. 700004 558
  40. 700005 348
  41. 700013 758
  42. 700015 738
  43. 700019 158
  44. """
  45. #get(
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement