This question already has an answer here:
- Convert from binary to negabinary 10 answers
You will receive a number (may be negative) and a base (must be negative), and your task is to convert the number into the base.
The base will only be from
- You may receive the number in any positive base, including unary.
- You may choose receive the magnitude of the base instead (
- The input can be taken in any reasonable format.
This is code-golf, shortest solution in bytes wins.
input output 8163, -10 12243 -8163, -10 9977 17, -3 212