Clear questions and runnable code get the best and fastest answer 

PerlMonks 
Re: Negabinary Number Systemby Cirollo (Friar) 
on Sep 06, 2001 at 03:19 UTC ( #110446=note: print w/ replies, xml )  Need Help?? 
Maybe you should take a more serious look at the balanced ternary number system. (described in TAOCP, vol. 2 ch. 4.1, p207, you've probably already read about it) Knuth says it is "perhaps the prettiest number system of all," and it has some properties that are quite beautiful. For those who aren't familiar with balanced ternary notation, it's similar to what you would expect of base 3  except, instead of the digits 0, 1 and 2, one uses 1, 0 and 1 (1 being denoted by a 1 with a bar over it). Like negabinary, this system is unsigned; instead, the sign is captured in the representation of the number itself. And, according to Knuth, a balanced ternay representation of a number requires only about 63% as many digit positions as its binary representation. There were even a number of computers built based on the balanced ternary system. Instead of using "off" and "on" in an electrical system, I assume one would use "positive," "negative," and "off" voltages, which is really an interesting concept.
In Section
Meditations

