Advertisement
ForestFox

4-6, 8

Jun 14th, 2021
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. # 4
  2. count, summa = 0, 0
  3. for i in range(12094, 20075):
  4. if (i%16==15) and (i%3==0) and (i%8!=0) and (i%14!=0) and (i%19!=0):
  5. count += 1
  6. summa += i
  7. print('Problem #4', summa, count)
  8. # 6
  9. count, m = 0, 0
  10. for i in range(2461, 9720):
  11. s = str(i)
  12. if '3'<=s[-2]<='7' and s[-3] != '1' and s[-3] != '9':
  13. count += 1
  14. m = i
  15. print('Problem #6', count, m)
  16. # 5
  17. minimum, maximum = 8300, 0
  18. for i in range(3232, 8300):
  19. if (i%2==0 or i%7==0) and i%15!=0 and i%28!=0 and i%41!=0:
  20. if i<minimum:
  21. minimum = i
  22. if i > maximum:
  23. maximum = i
  24. print('Problem #5', minimum, maximum)
  25. # 8
  26.  
  27. for i in range(100, 1000):
  28. x = i
  29. L = x - 30
  30. M = x + 30
  31. while L != M:
  32. if L > M:
  33. L = L - M
  34. else:
  35. M = M - L
  36. if M == 30:
  37. print('Problem #8', x)
  38. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement