Negabinary Numbers to Decimal

The negabinary representation of a number is its representation using base . Similarly, as with the ordinary binary number base, negabinary uses the digits 0 and 1, the difference being in its use of powers of to convert a negabinary number to its decimal equivalent. This Demonstration illustrates the steps of the conversion of a negabinary number into decimal. You choose a decimal number; the program converts it to negabinary and back to decimal.
Here is how to do this. First, powers of are selected according to the positions of the 1 digits, increasing from 0 in unit steps from right to left. Then the powers are computed and finally, adding all results gives the desired decimal equivalent. Some numbers have the same representation in binary and negabinary bases. Can you tell how we can recognize those from, say, their binary representation?



  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


[1] M. Gardner, Knotted Doughnuts and Other Mathematical Entertainments, New York: W.H. Freeman, 1986.
[2] D. E. Knuth, The Art of Computer Programming, Vol. 2: Seminumerical Algorithms, 3rd ed., Reading, MA: Addison–Wesley, 1998.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+