import timeit
print(timeit.timeit("int('{0:b}'.format(n)[::-1], 2)", 'n = 123456'))
print(timeit.timeit('int(bin(n)[:1:-1], 2)', 'n = 123456'))
print(timeit.timeit("int(''.join(reversed(bin(n)[2:])),2)", 'n = 123456'))
Slick way to reverse the (binary) digits of a number in Python?