Re: [algogeeks] Converting a decimal number to base -2

2010-08-30 Thread jaladhi dave
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

[algogeeks] Converting a decimal number to base -2

2010-08-30 Thread Maria
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