Skip to content

Instantly share code, notes, and snippets.

@ElenaG518
Created January 9, 2019 00:16
Show Gist options
  • Save ElenaG518/91aa22ea618cb6f2a8def9a1e2cd71fc to your computer and use it in GitHub Desktop.
Save ElenaG518/91aa22ea618cb6f2a8def9a1e2cd71fc to your computer and use it in GitHub Desktop.
Binary
What is 2^5 in binary?
100000 = 32 = [1]*2^(5)+ [0]*2^(4) + [0]*2^(3) + [0]*2^(2) + [0]*2^(1) + [0]*2^(0))
What is 2^5 - 1 in binary?
011111 = 31 = [0]*2^(5)+ [1]*2^(4) + [1]*2^(3) + [1]*2^(2) + [1]*2^(1) + [1]*2^(0))
What is the general rule for binary numbers which are of the form 2^n or 2^n - 1?
They are the One's complement fo each other, or the inverse binary digits of each other.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment