<s>
Balanced	B-Algorithm
ternary	I-Algorithm
is	O
a	O
ternary	B-Algorithm
numeral	I-Algorithm
system	I-Algorithm
(	O
i.e.	O
</s>
<s>
base	B-Algorithm
3	I-Algorithm
with	O
three	O
digits	O
)	O
that	O
uses	O
a	O
balanced	O
signed-digit	O
representation	O
of	O
the	O
integers	O
in	O
which	O
the	O
digits	O
have	O
the	O
values	O
−1	O
,	O
0	O
,	O
and	O
1	O
.	O
</s>
<s>
This	O
stands	O
in	O
contrast	O
to	O
the	O
standard	O
(	O
unbalanced	O
)	O
ternary	B-Algorithm
system	O
,	O
in	O
which	O
digits	O
have	O
values	O
0	O
,	O
1	O
and	O
2	O
.	O
</s>
<s>
The	O
balanced	B-Algorithm
ternary	I-Algorithm
system	I-Algorithm
can	O
represent	O
all	O
integers	O
without	O
using	O
a	O
separate	O
minus	O
sign	O
;	O
the	O
value	O
of	O
the	O
leading	O
non-zero	O
digit	O
of	O
a	O
number	O
has	O
the	O
sign	O
of	O
the	O
number	O
itself	O
.	O
</s>
<s>
The	O
balanced	B-Algorithm
ternary	I-Algorithm
system	I-Algorithm
is	O
an	O
example	O
of	O
a	O
non-standard	O
positional	O
numeral	O
system	O
.	O
</s>
<s>
Different	O
sources	O
use	O
different	O
glyphs	O
used	O
to	O
represent	O
the	O
three	O
digits	O
in	O
balanced	B-Algorithm
ternary	I-Algorithm
.	O
</s>
<s>
In	O
publications	O
about	O
the	O
Setun	B-Device
computer	O
,	O
−1	O
is	O
represented	O
as	O
overturned	O
1	O
:	O
"	O
1	O
"	O
.	O
</s>
<s>
Balanced	B-Algorithm
ternary	I-Algorithm
makes	O
an	O
early	O
appearance	O
in	O
Michael	O
Stifel	O
's	O
book	O
Arithmetica	O
Integra	O
(	O
1544	O
)	O
.	O
</s>
<s>
The	O
set	O
together	O
with	O
the	O
function	O
forms	O
a	O
balanced	O
signed-digit	O
representation	O
called	O
the	O
balanced	B-Algorithm
ternary	I-Algorithm
system	I-Algorithm
.	O
</s>
<s>
The	O
map	O
is	O
surjective	B-Algorithm
but	O
not	O
injective	O
since	O
,	O
for	O
example	O
,	O
However	O
,	O
every	O
integer	O
has	O
exactly	O
one	O
representation	O
under	O
that	O
does	O
not	O
end	O
(	O
on	O
the	O
left	O
)	O
with	O
the	O
symbol	O
i.e.	O
</s>
<s>
In	O
the	O
balanced	B-Algorithm
ternary	I-Algorithm
system	I-Algorithm
the	O
value	O
of	O
a	O
digit	O
n	O
places	O
left	O
of	O
the	O
radix	B-Algorithm
point	I-Algorithm
is	O
the	O
product	O
of	O
the	O
digit	O
and	O
3n	O
.	O
</s>
<s>
This	O
is	O
useful	O
when	O
converting	O
between	O
decimal	O
and	O
balanced	B-Algorithm
ternary	I-Algorithm
.	O
</s>
<s>
In	O
the	O
following	O
the	O
strings	O
denoting	O
balanced	B-Algorithm
ternary	I-Algorithm
carry	O
the	O
suffix	O
,	O
bal3	O
.	O
</s>
<s>
Similarly	O
,	O
the	O
first	O
place	O
to	O
the	O
right	O
of	O
the	O
radix	B-Algorithm
point	I-Algorithm
holds	O
3−1	O
=	O
,	O
the	O
second	O
place	O
holds	O
3−2	O
=	O
,	O
and	O
so	O
on	O
.	O
</s>
<s>
We	O
may	O
check	O
the	O
parity	O
of	O
a	O
balanced	B-Algorithm
ternary	I-Algorithm
integer	O
by	O
checking	O
the	O
parity	O
of	O
the	O
sum	O
of	O
all	O
trits	B-Algorithm
.	O
</s>
<s>
Balanced	B-Algorithm
ternary	I-Algorithm
can	O
also	O
be	O
extended	O
to	O
fractional	O
numbers	O
similar	O
to	O
how	O
decimal	O
numbers	O
are	O
written	O
to	O
the	O
right	O
of	O
the	O
radix	B-Algorithm
point	I-Algorithm
.	O
</s>
<s>
Some	O
balanced	B-Algorithm
ternary	I-Algorithm
fractions	O
have	O
multiple	O
representations	O
too	O
.	O
</s>
<s>
Certainly	O
,	O
in	O
the	O
decimal	O
and	O
binary	O
,	O
we	O
may	O
omit	O
the	O
rightmost	O
trailing	O
infinite	O
0s	O
after	O
the	O
radix	B-Algorithm
point	I-Algorithm
and	O
gain	O
a	O
representations	O
of	O
integer	O
or	O
terminating	O
fraction	O
.	O
</s>
<s>
But	O
,	O
in	O
balanced	B-Algorithm
ternary	I-Algorithm
,	O
we	O
ca	O
n't	O
omit	O
the	O
rightmost	O
trailing	O
infinite	O
−1s	O
after	O
the	O
radix	B-Algorithm
point	I-Algorithm
in	O
order	O
to	O
gain	O
a	O
representations	O
of	O
integer	O
or	O
terminating	O
fraction	O
.	O
</s>
<s>
The	O
basic	O
operationsaddition	O
,	O
subtraction	O
,	O
multiplication	O
,	O
and	O
divisionare	O
done	O
as	O
in	O
regular	O
ternary	B-Algorithm
.	O
</s>
<s>
Multiplication	O
by	O
two	O
can	O
be	O
done	O
by	O
adding	O
a	O
number	O
to	O
itself	O
,	O
or	O
subtracting	O
itself	O
after	O
a-trit-left-shifting	O
.	O
</s>
<s>
An	O
arithmetic	O
shift	O
left	O
of	O
a	O
balanced	B-Algorithm
ternary	I-Algorithm
number	O
is	O
the	O
equivalent	O
of	O
multiplication	O
by	O
a	O
(	O
positive	O
,	O
integral	O
)	O
power	O
of	O
3	O
;	O
and	O
an	O
arithmetic	O
shift	O
right	O
of	O
a	O
balanced	B-Algorithm
ternary	I-Algorithm
number	O
is	O
the	O
equivalent	O
of	O
division	O
by	O
a	O
(	O
positive	O
,	O
integral	O
)	O
power	O
of	O
3	O
.	O
</s>
<s>
The	O
conversion	O
of	O
a	O
repeating	O
balanced	B-Algorithm
ternary	I-Algorithm
number	O
to	O
a	O
fraction	O
is	O
analogous	O
to	O
converting	O
a	O
repeating	O
decimal	O
.	O
</s>
<s>
The	O
balanced	B-Algorithm
ternary	I-Algorithm
expansions	O
of	O
is	O
given	O
in	O
OEIS	O
as	O
,	O
that	O
of	O
in	O
.	O
</s>
<s>
Unbalanced	O
ternary	B-Algorithm
can	O
be	O
converted	O
to	O
balanced	B-Algorithm
ternary	I-Algorithm
notation	O
in	O
two	O
ways	O
:	O
</s>
<s>
Add	O
1	O
trit-by-trit	O
from	O
the	O
first	O
non-zero	O
trit	B-Algorithm
with	O
carry	O
,	O
and	O
then	O
subtract	O
1	O
trit-by-trit	O
from	O
the	O
same	O
trit	B-Algorithm
without	O
borrow	O
.	O
</s>
<s>
If	O
a	O
2	O
is	O
present	O
in	O
ternary	B-Algorithm
,	O
turn	O
it	O
into	O
1T	O
.	O
</s>
<s>
If	O
the	O
three	O
values	O
of	O
ternary	B-Language
logic	I-Language
are	O
false	O
,	O
unknown	O
and	O
true	O
,	O
and	O
these	O
are	O
mapped	O
to	O
balanced	B-Algorithm
ternary	I-Algorithm
as	O
T	O
,	O
0	O
and	O
1	O
and	O
to	O
conventional	O
unsigned	O
ternary	B-Algorithm
values	O
as	O
0	O
,	O
1	O
and	O
2	O
,	O
then	O
balanced	B-Algorithm
ternary	I-Algorithm
can	O
be	O
viewed	O
as	O
a	O
biased	O
number	O
system	O
analogous	O
to	O
the	O
offset	O
binary	O
system	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
if	O
these	O
two	O
representations	O
are	O
used	O
for	O
balanced	O
and	O
unsigned	O
ternary	B-Algorithm
numbers	I-Algorithm
,	O
an	O
unsigned	O
n-trit	O
positive	O
ternary	B-Algorithm
value	O
can	O
be	O
converted	O
to	O
balanced	O
form	O
by	O
adding	O
the	O
bias	O
b	O
and	O
a	O
positive	O
balanced	O
number	O
can	O
be	O
converted	O
to	O
unsigned	O
form	O
by	O
subtracting	O
the	O
bias	O
b	O
.	O
</s>
<s>
Furthermore	O
,	O
if	O
x	O
and	O
y	O
are	O
balanced	O
numbers	O
,	O
their	O
balanced	O
sum	O
is	O
when	O
computed	O
using	O
conventional	O
unsigned	O
ternary	B-Algorithm
arithmetic	I-Algorithm
.	O
</s>
<s>
Similarly	O
,	O
if	O
x	O
and	O
y	O
are	O
conventional	O
unsigned	O
ternary	B-Algorithm
numbers	I-Algorithm
,	O
their	O
sum	O
is	O
when	O
computed	O
using	O
balanced	B-Algorithm
ternary	I-Algorithm
arithmetic	O
.	O
</s>
<s>
We	O
may	O
convert	O
to	O
balanced	B-Algorithm
ternary	I-Algorithm
with	O
the	O
following	O
formula	O
:	O
</s>
<s>
ak	O
and	O
ck	O
are	O
the	O
digits	O
k	O
places	O
to	O
the	O
left	O
and	O
right	O
of	O
the	O
radix	B-Algorithm
point	I-Algorithm
respectively	O
.	O
</s>
<s>
The	O
single-trit	O
addition	O
,	O
subtraction	O
,	O
multiplication	O
and	O
division	O
tables	O
are	O
shown	O
below	O
.	O
</s>
<s>
Multi-trit	O
addition	O
and	O
subtraction	O
is	O
analogous	O
to	O
that	O
of	O
binary	O
and	O
decimal	O
.	O
</s>
<s>
Add	O
and	O
subtract	O
trit	B-Algorithm
by	O
trit	B-Algorithm
,	O
and	O
add	O
the	O
carry	O
appropriately	O
.	O
</s>
<s>
Multi-trit	O
multiplication	O
is	O
analogous	O
to	O
that	O
of	O
binary	O
and	O
decimal	O
.	O
</s>
<s>
Balanced	B-Algorithm
ternary	I-Algorithm
division	O
is	O
analogous	O
to	O
that	O
of	O
binary	O
and	O
decimal	O
.	O
</s>
<s>
If	O
the	O
dividend	O
over	O
the	O
plus	O
or	O
minus	O
half	O
divisor	O
,	O
the	O
trit	B-Algorithm
of	O
the	O
quotient	O
must	O
be	O
1	O
or	O
T	O
.	O
If	O
the	O
dividend	O
is	O
between	O
the	O
plus	O
and	O
minus	O
of	O
half	O
the	O
divisor	O
,	O
the	O
trit	B-Algorithm
of	O
the	O
quotient	O
is	O
0	O
.	O
</s>
<s>
The	O
magnitude	O
of	O
the	O
dividend	O
must	O
be	O
compared	O
with	O
that	O
of	O
half	O
the	O
divisor	O
before	O
setting	O
the	O
quotient	O
trit	B-Algorithm
.	O
</s>
<s>
1T	O
1T	O
=	O
1T	O
,	O
trits	B-Algorithm
end	O
,	O
set	O
TTTTTTTTT	O
...	O
or	O
111111111	O
...	O
</s>
<s>
The	O
process	O
of	O
extracting	O
the	O
square	O
root	O
in	O
balanced	B-Algorithm
ternary	I-Algorithm
is	O
analogous	O
to	O
that	O
in	O
decimal	O
or	O
binary	O
.	O
</s>
<s>
Extraction	O
of	O
the	O
cube	O
root	O
in	O
balanced	B-Algorithm
ternary	I-Algorithm
is	O
similarly	O
analogous	O
to	O
extraction	O
in	O
decimal	O
or	O
binary	O
:	O
</s>
<s>
In	O
the	O
early	O
days	O
of	O
computing	O
,	O
a	O
few	O
experimental	O
Soviet	O
computers	O
were	O
built	O
with	O
balanced	B-Algorithm
ternary	I-Algorithm
instead	O
of	O
binary	O
,	O
the	O
most	O
famous	O
being	O
the	O
Setun	B-Device
,	O
built	O
by	O
Nikolay	O
Brusentsov	O
and	O
Sergei	O
Sobolev	O
.	O
</s>
<s>
The	O
notation	O
has	O
a	O
number	O
of	O
computational	O
advantages	O
over	O
traditional	O
binary	O
and	O
ternary	B-Algorithm
.	O
</s>
<s>
In	O
balanced	B-Algorithm
ternary	I-Algorithm
,	O
the	O
one-digit	O
multiplication	O
table	O
remains	O
one-digit	O
and	O
has	O
no	O
carry	O
and	O
the	O
addition	O
table	O
has	O
only	O
two	O
carries	O
out	O
of	O
nine	O
entries	O
,	O
compared	O
to	O
unbalanced	O
ternary	B-Algorithm
with	O
one	O
and	O
three	O
respectively	O
.	O
</s>
<s>
"	O
The	O
complexity	O
of	O
arithmetic	O
circuitry	O
for	O
balanced	B-Algorithm
ternary	I-Algorithm
arithmetic	O
is	O
not	O
much	O
greater	O
than	O
it	O
is	O
for	O
the	O
binary	O
system	O
,	O
and	O
a	O
given	O
number	O
requires	O
only	O
as	O
many	O
digit	O
positions	O
for	O
its	O
representation	O
.	O
</s>
<s>
Balanced	B-Algorithm
ternary	I-Algorithm
has	O
other	O
applications	O
besides	O
computing	O
.	O
</s>
<s>
They	O
may	O
also	O
provide	O
a	O
more	O
natural	O
representation	O
for	O
the	O
qutrit	B-Device
and	O
systems	O
that	O
use	O
it	O
.	O
</s>
