Find an algorithm for writing any positive integer in negabinary, i.e., as a sum of powers of -2.
For example,
7 = 11011 = (-2)4 + (-2)3 + (-2)1 + (-2)0 19 = 10111 = (-2)4 + (-2)2 + (-2)1 + (-2)0Source: This was a "contest problem" at a recent Mathematica conference. It was communicated to us by Stan Wagon.© Copyright 2000 Stan Wagon. Reproduced with permission.