Balanced quaternary

402 Views Asked by At

I was doing some research on representation of numbers, and I found out about Balanced Ternary base to represent numbers with only {-1, 0, 1}. I got the ideea of how to convert from decimal to Balanced Ternary base and vice versa. But what about Balanced Quaternary Base, using {-1, 0, 1, 2}. To represent 27 we do so: 27%4=3 (we put -1 and add 1 to 27/4). 6+1=7%4=3 (we put again -1 and add 1 to 7/4). 1+1=2. So we have the folowing representation: 2(-1)(-1)=2TT. 2*4^2-4^1-4^0=2*16-4-1=32-5=27. But what about -6? I thought of thinking about the first power of 4 greater than -(-6). That would be 16. We add -6 to 16 and get 10. We represent 10 like we done with 27 , just that we add T in front of the number. It will look like this: T22. I found out this is not right everytime, and I shouldn't do this type of conversion. My question is: how can we represent -6 in Quaternary Base?