17 lines
1016 B
Plaintext
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 -62 (or something "higher"), expresses the <br>name of the language being used (with correct capitalization). If the computer language has <br>non-alphanumeric characters, try to encode them into the negatory numerals, or use other <br>characters instead.
|
|
<br><br>
|
|
|