Ternary is the base-3 numeral system in which only the digits 0, 1, and 2 are used.
Ternary numbers arise in a number of problems in mathematics, including some problems
of weighing. However, according to Knuth (1998), "no
substantial application of balanced ternary notation has been made" (balanced
ternary uses digits , 0, and 1 instead of 0, 1, and
2).
The ternary representations of the nonnegative integers, written as digit strings,
are 0, 1, 2, 10, 11, 12, 20, ... (OEIS A007089).
The positive integers whose ternary representations
are primes when read as decimal integers begin 2, 4, 10, 22, 34, 46, ... (OEIS A036954).
For example, 4 has representation , and the decimal integer 11 is prime. This
construction tests the decimal interpretation of the
digits, rather than the original ternary value.
The illustration above shows a graphical representation of the integers from 0 to 25 in ternary, and the following table gives the ternary equivalents of the first few decimal integers. The concatenation of the ternary digits of the consecutive numbers 0, 1, 2, 3, ... gives (0), (1), (2), (1, 0), (1, 1), (1, 2), (2, 0), ... (OEIS A054635).
| 1 | 1 | 11 | 102 | 21 | 210 |
| 2 | 2 | 12 | 110 | 22 | 211 |
| 3 | 10 | 13 | 111 | 23 | 212 |
| 4 | 11 | 14 | 112 | 24 | 220 |
| 5 | 12 | 15 | 120 | 25 | 221 |
| 6 | 20 | 16 | 121 | 26 | 222 |
| 7 | 21 | 17 | 122 | 27 | 1000 |
| 8 | 22 | 18 | 200 | 28 | 1001 |
| 9 | 100 | 19 | 201 | 29 | 1002 |
| 10 | 101 | 20 | 202 | 30 | 1010 |
Ternary digits have the following multiplication table.
| 0 | 1 | 2 | |
| 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 2 |
| 2 | 0 | 2 | 11 |
For a three-state totalistic cellular automaton with a neighborhood of three cells, a ternary representation uniquely
identifies its rule. The three colors (white, gray, and black) correspond to the
three numbers 0, 1, and 2 (Wolfram 2002, pp. 60-70
and 886).
For example, the ternary digits lead to the code 600 totalistic
cellular automaton.
Every even number represented in ternary has an even number (possibly 0) of 1s. This is true since a
nonnegative integer is congruent modulo to its digit
sum in base
. In the case
,
there is only one digit (1) which is not a multiple
of
, so all we have to do is "cast out twos"
and count the number of 1s in the base-3 representation.
The following table gives
for
, 2, ... in ternary.
|
(1)
| |||
|
(2)
| |||
|
(3)
| |||
|
(4)
| |||
|
(5)
| |||
|
(6)
| |||
|
(7)
|
N. J. A. Sloane conjectured that for any integer ,
always has a 0 in its ternary expansion (Sloane 1973, p. 98;
Vardi 1991, p. 28). Known positive integer
values of
such that
lacks
a 0 begin with 1, 2, 3, 4, 15, ... (OEIS A102483),
with no others up to
(E. W. Weisstein, Apr. 8, 2006). The positions (counting from 1 at
the least significant ternary digit, with 0 denoting absence)
of the first 0 digit in
,
, ..., are 0, 0, 0, 0, 3, 2, 2, 4, 4, 5, 4, 2,
2, 4, 0, 3, 4, ... (OEIS A117970).
It is conjectured that, for positive integers ,
has a 1 in its ternary expansion except when
,
3, or 9. This is equivalent to the conjecture about
the occurrence of a 2 in
(Saye 2022). No further exceptions were found up to
(E. W. Weisstein, Apr. 8, 2006).
Erdős and Graham (1980) conjectured that no power of 2, , for integers
is a sum of distinct powers
of 3. This is equivalent to the requirement that the ternary expansion of
always contains a 2 for
.
For positive integers
,
Vardi (1991) verified that the only values of
for which
has no 2 in its ternary expansion are 2 and 8 up to
. The positions
(counting from 1 at the least significant ternary digit,
with 0 denoting absence) of the first 2 digit in
,
, ..., are 1, 0, 1, 2, 1,
4, 1, 0, 1, 2, 1, 3, 1, 3, ... (OEIS A117971).
Stérin and Woods (2024) constructed a 15-state, 2-symbol Turing machine that starts on a blank tape and halts iff some
with
has no ternary digit 2. The
conjecture is thus equivalent to this machine running
forever. The Cryptids project (2026) formalized the equivalence in Lean, including
the version for Stérin's 14-state Turing machine.
The Cryptids project reports assistance from Claude in the formalization and a published
build compiling both reductions (Cryptids 2026). The halting behavior of these machines
remains open.