RosettaCodeData/Task/Negative-base-numbers/00-TASK.txt

17 lines
1016 B
Plaintext

Negative base numbers are an alternate way to encode numbers without the need for a minus sign. Various negative bases may be used including negadecimal (base -10), negabinary (-2) and negaternary (-3).<ref>[http://mathworld.wolfram.com/Negabinary.html Negabinary on Wolfram Mathworld]</ref><ref>[https://en.wikipedia.org/wiki/Negative_base Negative base] on Wikipedia</ref>
;Task:
*Encode the decimal number 10 as negabinary (expect 11110)
*Encode the decimal number 146 as negaternary (expect 21102)
*Encode the decimal number 15 as negadecimal (expect 195)
*In each of the above cases, convert the encoded number back to decimal.
;extra credit:
* supply an integer, that when encoded to base &nbsp; -62 &nbsp; (or something "higher"), &nbsp; expresses the <br>name of the language being used &nbsp; (with correct capitalization). &nbsp; If the computer language has <br>non-alphanumeric characters, &nbsp; try to encode them into the negatory numerals, &nbsp; or use other <br>characters instead.
<br><br>