| Antibase Two | #: _ 1 0 | Antibase |
#: y is the binary representation of y ,
and is equivalent to (m#2)#:y , where m
is the maximum of the number of digits needed to represent the atoms
of y in base 2 . For example:
i. 8
0 1 2 3 4 5 6 7
#: i. 8
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
|
In simple cases r&#: is inverse to r&#. .
Thus:r=: 24 60 60 r #: r #. 2 3 4 2 3 4But if r #. y exceeds (*/r)-1 (the largest integer representable in the radix r), then the result of r#:y is reduced modulo */r . For example: r #: r #. 29 3 4 5 3 4 |
ndr=: 1: + <.@^. Number of digits required 10 ndr y=: 9 10 11 100 99 100 1 2 2 3 2 3 (y#:~10 #~ >./10 ndr y);(y#:~8 #~ >./8 ndr y) +-----+-----+ |0 0 9|0 1 1| |0 1 0|0 1 2| |0 1 1|0 1 3| |1 0 0|1 4 4| |0 9 9|1 4 3| |1 0 0|1 4 4| +-----+-----+ (10.^:_1 ; 8.^:_1) y +-----+-----+ |0 0 9|0 1 1| |0 1 0|0 1 2| |0 1 1|0 1 3| |1 0 0|1 4 4| |0 9 9|1 4 3| |1 0 0|1 4 4| +-----+-----+