Advertisement
Korotkodul

dem13.n5

Jun 13th, 2023
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. def f(N):
  2.     s = bin(N)[2:]
  3.     if N % 2 == 1:
  4.         s = '1' + s + '00'
  5.         return int(s,2)
  6.     k = 0
  7.     for i in s:
  8.         k += int(i)
  9.     s += bin(k)[2:]
  10.     return int(s,2)
  11. k = 0
  12. for N in range(1,10**3):
  13.     F = f(N)
  14.     if F >= 500 and F <= 700:
  15.         k += 1
  16.         print(N)
  17. print(k)
  18. """
  19. 61
  20. 62
  21. 63
  22. 78
  23. 86
  24. 130
  25. 132
  26. 134
  27. 136
  28. 138
  29. 140
  30. 144
  31. 146
  32. 148
  33. 152
  34. 160
  35. 162
  36. 164
  37. 168
  38. 256
  39. """
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement