Skip to main content
fix formatting
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241

Python 37 bytes

Python 2, 37 bytes

f=input()+1
while f&2*f:f+=1
print f

Used the logic x& 2*x == 0x & 2*x == 0 for 1-sparse number.
Thanks to @Nick and @CarpetPython.

Python 37 bytes

f=input()+1
while f&2*f:f+=1
print f

Used the logic x& 2*x == 0 for 1-sparse number.
Thanks to @Nick and @CarpetPython.

Python 2, 37 bytes

f=input()+1
while f&2*f:f+=1
print f

Used the logic x & 2*x == 0 for 1-sparse number.
Thanks to @Nick and @CarpetPython.

Source Link
smanna
  • 459
  • 5
  • 11

Python 37 bytes

f=input()+1
while f&2*f:f+=1
print f

Used the logic x& 2*x == 0 for 1-sparse number.
Thanks to @Nick and @CarpetPython.