Skip to content

Instantly share code, notes, and snippets.

@TheBlackPlague
Last active September 18, 2021 15:47
Show Gist options
  • Save TheBlackPlague/a1d8cb483cff3fc303efcf5402f5d97b to your computer and use it in GitHub Desktop.
Save TheBlackPlague/a1d8cb483cff3fc303efcf5402f5d97b to your computer and use it in GitHub Desktop.
x = 102385; # Can be any unsigned integer of your liking.
bin = ''
while x != 0:
z = x % 2;
x = (x / 2) - (z / 2)
bin += str(int(z))
print(bin[::-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment