Answer to Question #308790 in Discrete Mathematics for kim

Question #308790

I would like to ask for help with discrete mathematics, especially two's complement

  1. Using two’s complement representation throughout your calculation, find 31 – 19. 
  2.     Using Euclidean algorithm, find the GCD of 123 and 411.  
1
Expert's answer
2022-03-10T18:07:55-0500

Solution (1)

Step 1:

Find the 2's complement of the number to be subtracted.


Here we have to subtract 19 from 31, therefore first we will find 2's complement.


2's Complement of 19


The binary equivalent of 19 is 19 = (10011)2


And the binary equivalent of 31 is = (11111)2


Now1's complement of 10011 is 01100


Adding 1 to 1's compliment


01100

+ 00001

= 01101


Hence 2's complement of 19 is 01101




Step 2:


We add the 2's complement of 19 to 31. Therefore,


31 - 19 = 31 + (2's complement of 19)


= 11111 + 01101


11111

01101

= 101100




Step 3:


Now ignoring the last cary digit, which is 1, we get


31 - 19 = (01100)2


31 - 19 = 12



Solution (2)


Here 411 > 123, so we start writing 411 in terms of 123


Step 1: 411 = 123 x 3 + 42


Step 2: 123 = 42 x 2 + 39


Step 3: 42 = 39 x 1 + 3


Step 4: 39 = 3 x 13 + 0


Since we see that the remainder is zero, therefore, we stop dividing, and the resulting GCD of 123 and 411 is 3





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS