0
$\begingroup$

I am looking at https://en.wikipedia.org/wiki/Negative_base as a reference for converting base 10 to base -3 example. Converting back from -3 base to base 10 does not yield the same result. The example under calculation does not make sense: (146) in base 10 => 20121 in base -3 I think it should be 12102 in base -3 (digits reversed)

2*(-3)^0 + 0*(-3)^1 + 1*(-3)^2 + 2*(-3)^3 + 1*(-3)^4 = 2 - 0 + 9 -54 + 81 = 38 in base 10

Either answer won't convert back to 146 in base 10. What am I missing?

  • 0
    $3^3=27$ so the sum should be $2-0+9-54+81=38$.2017-01-11
  • 0
    I get 146 (in decimal) is represented by 21102 in negaternary. Not sure how the wiki page works it out.2017-01-11
  • 0
    Thanks for catching the addition mistake. Fixed it. Can you please explain how you got 21102? was following wiki instructions and dividing by -3 and taking remainder, creating sequence starting from unit digit. Not sure where I messed up.2017-01-11
  • 0
    I got 21102 by reverse-engineering it. I couldn't follow the instructions on the wiki, either.2017-01-11
  • 0
    Thanks Scott. I am trying to teach my kid, so if someone has a systematic technique, let me know.2017-01-12

1 Answers 1

0

Able to track down the issue with the wiki. Thanks to http://mathforum.org/dr.math to help me figure out.

146 / -3 = -48, remainder 2 [since 146 = -3*-48 + 2]

-48 / -3 = 16, remainder 0 [since -48 = -3*16 + 0]

16 / -3 = -5, remainder 1 [since 16 = -3*-5 + 1]

-5 / -3 = 2, remainder 1 [since -5 = -3*2 + 1]

2 / -3 =   0, remainder 2  [since   2 = -3*0   + 2]

The last two lines are wrong in the wiki work, and they failed to write the answer starting with the last remainder as they said. The answer is 21102 as posted by Scott.

2(-3)^4 + 1(-3)^3 + 1(-3)^2 + 0(-3)^1 + 2(-3)^0 = 162 - 27 + 9 + 0 + 2 = 146

In general, If the remainder is negative, add 1 to the quotient and add the absolute value of the base to the remainder.