Advertisement
Pastehsjsjs

Untitled

Mar 7th, 2023
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. def f(N):
  2. N2 = bin(N)[2:]
  3. if N % 2 == 0:
  4. N2 = f'1{N2}0'
  5. else:
  6. N2 = f'11{N2}10'
  7. return int(N2, 2)
  8.  
  9.  
  10. res = 100**10
  11. for N in range(1, 100000):
  12. R = f(N)
  13. if sum([int(i) for i in str(R)]) > 17:
  14. res = min(res, R)
  15.  
  16. print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement