In: Computer Science
Convert each of the following 5-digit 6’s complement base 7 numbers to 9-digit 4’s complement base 4. Be careful, show all your reasoning/arithmetic, and make no unwarranted assumptions!
(a) 50135
(b) 11402
Solution
Step 1: By definition, the formula of the base or radix complement of an n digit number y in radix b is bn-y. There is a diminished radix complement given as (bn-1)-y.
For example Take the number (1010)2. The base or radix=b=2. Number of digits=n=4. Then 1's complement is diminished radix complement which is (24-1)-(1010)
=(16-1)-(1010)=(15)-(1010)=(1111-1010)=0101
Step 2: Similarly we have
(i)(50135)7 in 6's complement=((bn-1)-y)7. We need (b1n1-y1)4.
(7^5-1)-y=50135
y=((16807)10-1)-(50135)7)
=1680710-1-1208010=472610 = 165317
(bn-1)-y=(b1n1-y1)
-> (50135)7=(49-y1)4
Convert 50135 from base 7 to base 4.
Converting 50135 to base 10.
5*74=12005
0*73=0
1*72=49
3*71=21
5*70=5
Adding all to get Ans=1208010
converting 1208010 to 4
The equation
calculation formula for 1208010 number to 4 is like this
below.
4|12080
4|3020|0
4|755|0
4|188|3
4|47|0
4|11|3
4|2|3
4|2|2
Ans:23303004
->23303004=(49-y1)4
->y1=49-23303004
->y1=(262144)10 - 23303004
Converting 262144 to base 10.
2*105=200000
6*104=60000
2*103=2000
1*102=100
4*101=40
4*100=4
Adding all to get Ans=26214410
converting 26214410 to 4
The equation
calculation formula for 26214410 number to 4 is like
this below.
4|262144
4|65536|0
4|16384|0
4|4096|0
4|1024|0
4|256|0
4|64|0
4|16|0
4|4|0
4|1|0
4|1|1
Ans:10000000004
y1=10000000004 - 23303004 = (262144)10 - 1208010 =25006410=3310031004.
But we need (49-331003100)4 = 26214410-25006410 = 1208010 = 23303004
Hence the answer is 23303004
Step 3 :
Number of digits n1=9, base=b1=4 and we need y1 value. Or, let us find the value of z ie (b1n1-y1)4
(11402)7=(b1n1-y1)4
So we need to convert 11402 to base 4 which is as follows
Converting 11402 to base 10.
1*74=2401
1*73=343
4*72=196
0*71=0
2*70=2
Adding all to get Ans=294210
Step2 converting 294210 to 4
The equation
calculation formula for 294210 number to 4 is like this
below.
4|2942
4|735|2
4|183|3
4|45|3
4|11|1
4|2|3
4|2|2
Ans:2313324
Hence the answer is 2313324