Python 3, (削除) 68 (削除ここまで) 66(削除) 66 (削除ここまで) 60 bytes
-2 bytes thanks to Mr. Xcoder!
-4 bytes thanks to ovs!
-2 bytes thanks to Erik the Outgolfer!
lambda n:max((n>>i+8<<i)+(n&2**i-1)n%2**i|n>>i+8<<i for i in range(len(bin(n))-109))
Python 3, (削除) 68 (削除ここまで) 66 bytes
-2 bytes thanks to Mr. Xcoder!
lambda n:max((n>>i+8<<i)+(n&2**i-1)for i in range(len(bin(n))-10))
Python 3, (削除) 68 (削除ここまで) (削除) 66 (削除ここまで) 60 bytes
-2 bytes thanks to Mr. Xcoder!
-4 bytes thanks to ovs!
-2 bytes thanks to Erik the Outgolfer!
lambda n:max(n%2**i|n>>i+8<<i for i in range(len(bin(n))-9))
Python 3, 68(削除) 68 (削除ここまで) 66 bytes
-2 bytes thanks to Mr. Xcoder!
lambda n:max((n>>i+8<<i)+(n&2**i-1)for i in range(n.bit_lengthlen(bin(n))-810))
Python 3, 68 bytes
lambda n:max((n>>i+8<<i)+(n&2**i-1)for i in range(n.bit_length()-8))
Python 3, (削除) 68 (削除ここまで) 66 bytes
-2 bytes thanks to Mr. Xcoder!
lambda n:max((n>>i+8<<i)+(n&2**i-1)for i in range(len(bin(n))-10))