How to double a number of binary digits in an integer? For example, if bin(x)="1001" then bin(y) must be "11000011". Is there any smart and fast algorithm ?

UPDATE: Here is an elegant solution:

''.join([''.join(i) for i in zip(X,X)])

where X is bin(int_x)[2:]

However, I am interested in a more faster way and for the integers of any size. Maybe an arithmetical transformation should help.

Edit
Report