Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Recover an integer from its negabinary representation
ResourceFunction["FromNegabinary"][n] recovers an integer from its negabinary representation. |
Recover 15 from negabinary:
In[1]:= |
Out[1]= |
Using ToNegabinary:
In[2]:= |
Out[2]= |
See the powers of -2 needed to recover the original integer:
In[3]:= |
Out[3]= |
In[4]:= |
Out[4]= |
FromNegabinary handles negative numbers:
In[5]:= |
Out[5]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License