Question
Find $6^{s}$ complement of $N=(268)_{10}$
My approach
First i converted $N=(268)_{10}$ to $(1124)_{6}$
then ,
i found the $6^{s}$ complement by subtrating $N$ from $r^{n}$
where $r$=base
$n$=number of digit
which is
$6^{4}-1124$=$1296-1124$=$172$
which seems to be incorrect because if i do using diminished radix complement
i.e using $5^{s}$ complement and then adding $1$ ,it is coming as-:
$(5555-N)$+$1$=$(5555-1124)+1$=$4432$
I am confused.
Please help me out !
$\endgroup$1 Answer
$\begingroup$Assume that the number $ N $ is written in base (or radix) $ r $. The radix complement of $ N $ is by definition
$$r^n-N=\left((r^n-1)-N\right)+1, \tag{1}$$
where $ n $ is the number of digits of $ N $.
Your error is in
$6^{4}-1124$=$1296-1124$=$172$
because the number $1124 $ is written in base $6$, while $1296 =6^4 $ is written in base $10$. Since $(6^4)_6=(10000)_6 $ you should have:
$$(6^4)_6-(1124)_6=(10000)_6 - ( 1124)_6 = (4432)_6. \tag{2}$$
Alternatively, for $ r=6$ and $N=(1124)_6$, $ n=4 $. And since $(6^4)_6-(1)_6=(5555)_6$, we obtain from $(1) $ the same result, confirming your last computation
$$\begin{align}(6^4)_6-(1124)_6&=((6^4)_6-(1)_6)-(1124)_6+(1 )_6 \\ &=(5555)_6-(1124)_6+(1)_6 \\&= (4431)_6+(1)_6\\&=(4432)_6.\tag{3}\end{align}$$
$\endgroup$