OFFSET
0,4
COMMENTS
Scanning from the left, find first occurrence of '10' in binary expansion and replace with '01' and return decimal representation or return n if no such swap exists. - Chai Wah Wu, Sep 06 2014
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..10000
EXAMPLE
If n = 9 = 1001_2 then a(9) = 0101_2 = 5.
PROG
(Python)
def A246592(n):
....s = bin(n)[2:]
....for i in range(len(s)-1):
........if s[i:i+2] == '10':
............return int(s[:i]+'01'+s[i+2:], 2)
....else:
........return n # Chai Wah Wu, Sep 06 2014
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Sep 03 2014
EXTENSIONS
More terms from Alois P. Heinz, Sep 03 2014
STATUS
approved