Advertisement
Korotkodul

dem23.n5

Jun 8th, 2023
739
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. def f(N):
  2.     s = bin(N)[2:]
  3.     print(s)
  4.     if s.count('1') % 2 == 0:
  5.         s += '0'
  6.         print(s)
  7.         s = '10' + s[2:]
  8.         print(s)
  9.     else:
  10.         s += '1'
  11.         print(s)
  12.         s = '11' + s[2:]
  13.         print(s)
  14.     return int(s,2)
  15.  
  16. f(15)
  17. i=1
  18. #while f(i) <= 40:
  19.     #i += 1
  20. #print(i)
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement