0

I have this simple problem which for some reason I have trouble with I'll be glad to get help.

I have these two numbers in base 10 :

5250, 321.

I change the basis from 10 to 9 then I get :

5250 --> 7173

321 ---> 386

I use the method of r complement with base 9:

First of all I'll find the the complement of 0386 in base 9 which is 6561-386=6175.

Therefore :

7173+6175=14358 (in base 9)

since its a complement to 9, we receive 4358 in base 9

Which is incorrect.

Any ideas why my method is incorrect?

Any help will be appreciated.

JaVaPG
  • 169
  • 1
  • 4
  • 9

1 Answers1

1

you are mixing bases. 6561 is base 10 for 10000 in base 9.

You need to calculate 100000 - 386 in base 9 to get the complement. This results in 88503. So 88503 is the 10's complement of 386 in base 9. Note the extra digit, otherwise 7173 will be a negative number in this representation.

Now you can calculate 7173 + 88503 = 106676. So the result is 6676 which is 4929 in decimal, which is the expected result.

mch
  • 9,424
  • 2
  • 28
  • 42
  • Thank you for your reply, can you explain why I need to calculate 100,000-386?, I think I should calculate 10,000-386 since 6561 in base 9 equals to 10,000 – JaVaPG Mar 04 '15 at 20:24
  • the problem is that `5250` in base 10 needs 5 digits to be representable in base 9 with complement representation, because `7173` is a negative number with 4 digits. You can think of the number `128` and calculate the binary representation with 8 digits: `1000 0000`. If you handle the `1000 000` like a 2's complement number it is `-128` and not `+128`. You need 1 more digit to show that it is `+128` (`0 1000 0000`), because `-128` is `1 1000 0000` in 9 digit 2's complement binary. – mch Mar 04 '15 at 21:05