Twitter Delicious Facebook Digg Stumbleupon Favorites More

Wednesday 28 September 2011

Finding r's complement and (r-1)'s complement of a number (1s complement and 2s complement)


Finding the r's and (r-1)'s complement

Here we are going to learn how to convert a number to its r's and (r-1)'s complement. 
Method:
Let 'N' is a number and r is its base where r>1 and in N,  'n' is the number of digits before its decimal point then  we can write 
r's complement of number = r^n-N

EX.
                       N = (23)10
                              here r = 10
                              n = 2 and N = 23 
hence we can write the 10's complement of this number as 10^2 - 23 = 77.
hence we can say that 10's comp of 23 is 77. 
Although this method is good enough to solve any problem regarding to this concept, but we will follow different method for finding r's and r-1's complement.

Easy Method:
Let we have to find again the 10's comp of 23 then this method tells us to divide 3 from 10 and 2 from 9 (i.e 10-9). which gives us a result of 77.

                               9  10
                           -  2    3
                                       
                               7    7
i.e the generalized form of writing a r's comp of a number 'abc' which is in r base, we can write.

                             (r-1)   (r-1)   r
                        -     a            b    c
                                                       

this difference gives us the r's comp of that number.
i.e we can find r's complement of a number by subtracting its right most digit by r and all digits by r-1.

Finding (r-1)'s complement:
We can do this easily by subtracting all the digits of that number from (r-1) where r is the base of that number.

EXAMPLES:  
Find the 10's and 9's complement of (348)10
ans:                   9   9   10
                       - 3   4     8
                                       
                        6    5    2    here 652 is 10's comp of 348 


9's comp          9    9    9 
                     -  3   4    8
                                      
                        6    5    1    here 651 is 9's comp of 348

from this method you can find the r's and (r-1)'s complement of any number with base r.

if any questions DO COMMENTS..

2 comments:

Anonymous said...

very poor aproach ...:( sorry for u

vasu naman said...

Thanks for your feedback... I will definitely try to improve... will welcome your further suggestion.

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Blogger Templates