2 ms·
My first reaction is to simply write all the powers of -2 (1, -2, 4, -8...) and simply brute force each of 1-10 to find a solution for how to write a particular
by esrauch 15y ago
My first reaction is to simply write all the powers of -2 (1, -2, 4, -8...) and simply brute force each of 1-10 to find a solution for how to write a particular number. I think this is what the OP replied below as "looks right", but I think thats actually simply one form of base 2.
The definition of writing something in base n is that you are expressing a number it using n unique values for each digit. Using these digits, there is a way of utilizing the space maximally to write any positive integer which is the above method of packing the values. Simply using n unique values and having each digit #d represent the power n^d.
For base -2, using -2 unique symbols is clearly nonsense. Assigning each digit a power of -2 and allowing for symbols 0 or 1 for each digit is actually just base 2, exactly like how gray code is base 2. It's interesting that its a form of base 2 that has an implicit sign-bit, but its also somewhat strange of a property since it ends up with twice as many negative numbers as positive numbers for any set number of bits.
Microsoft should clearly hire me.