Bits positioning and numbering would be interesting to represent here.. for
example...
2 = 110 == (1*(-2)^2 + 1*(-2)^1 + 0*(-2)^0) == (4 + (-2) + 0 )
3 = 111 == (1 *(-2)^2 + 1*(-2)^1 + 1*(-2)^0) == (4 + (-2) + 1)
4 = 100 == (1 *(-2)^2 + 0*(-2)^1 + 0*(-2)^0) == (4 + 0 + 0)
5 = 101 == (1 *(-2)^2
Write some code to convert a positive integer into base minus 2. That
is, whereas base 2 has a 1's place, a 2's place, a 4's place, etc.,
base minus 2 has a 1's place, a minus 2's place, a 4's place, a minus
8's place, ... (-2)^n.
--
You received this message because you are subscribed to the Goo