Base complement and (base-1) complement of any Number

By | December 16, 2022

Negative numbers in all number systems can be represented in complementary form. For any number system there exist two types of complements and they are:

  • Base complement
  • (Base-1) complement

1. (Base-1) Complement Calculation :

To calculate (base-1) complement of a given number we have to subtract each and every digit from (base-1) value. That is, if base or radix of a number is “x” then to find the (base-1) complement of that number we have to subtract each and every digit from (x-1).

Example: Calculate the 8’s complement of the base 9 number -6350.

If 9 is the base, then (base-1) value is 8. Therefore 8's complement is:

                              8888-6350 = 2538

2. Base Complement Calculation :

Method I
To calculate the base complement of a given number proceeds as follows:

  • Step 1: Scan the number from the right side and copy all leading zeros until the first non-zero digit is encountered.
  • Step 2: Subtract the first non-zero digit from “base value” and the rest of the digits from “base-1 value”.

Example: Calculate the base complement of the base 9 number -6350.

Scanning from right the first non-zero digit is 5. 
Subtract 5 from 9 and the remaining digits from 8. 
9-5 = 4
8-3 = 5
8-6 = 2

Therefore 9's complement of base 9 number -6350 is 2540.

Method II

  • Step 1: Calculate (base-1) complement of the number.
  • Step 2: Add 1 to the (base-1) complement value.

Example: Calculate the base-1 complement of the base 9 number -6350.

The 8's complement of -6350 is 2538.

Therefore 9's complement of base 9 number -6350 is:
2538+1 = 2540

Practice Questions:
(1) Calculate base complement of base 4 number -12300.
(2) Calculate base complement of decimal number -198021.
(3) Calculate base complement of base 14 number -A13.
(4) Calculate base-1 complement of base 4 number -12300.
(5) Calculate base-1 complement of base 4 number -635.

Answers:

(1) 21100
(2) 801979
(3) 3CB
(4) 21033
(5) 253

Please write comments below if you find anything incorrect, or you want to share more information about the topic discussed above. A gentle request to share this topic on your social media profile.

Author: Mithlesh Upadhyay

I hold an M.Tech degree in Artificial Intelligence (2023) from Delhi Technological University (DTU) and possess over 4 years of experience. I worked at GeeksforGeeks, leading teams and managing content, including GATE CS, Test Series, Placements, C, and C++. I've also contributed technical content to companies like MarsDev, Tutorialspoint, StudyTonight, TutorialCup, and Guru99. My skill set includes coding, Data Structures and Algorithms (DSA), and Object-Oriented Programming (OOPs). I'm proficient in C++, Python, JavaScript, HTML, CSS, Bootstrap, React.js, Node.js, MongoDB, Django, and Data Science.