fork(1) download
  1. def f(k):b=bin(k)[::-1];return len(b)-2-(b.count('1')==2),b.find('1')
  2.  
  3. for test in (15, 16, 40, 264, 17179867136):
  4. print(test, ' --> ', f(test))
Success #stdin #stdout 0.01s 9992KB
stdin
Standard input is empty
stdout
15  -->  (4, 0)
16  -->  (5, 4)
40  -->  (5, 3)
264  -->  (8, 3)
17179867136  -->  (34, 11)