Skip to main content
1 of 4
Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214

Python 3, 59 bytes

lambda n:int((bin(n).strip("0")+"01"*n)[1:len(bin(n))-1],2)

Try it online!

Not really happy with this yet...

Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214