This site is supported by donations to The OEIS Foundation.

Ternary numeral system

(Redirected from Base 3)

The ternary numeral system (base 3) is a place-value notation for numbers using the powers of 3 rather than the powers of 10. It can be used to represent integers, rational numbers, irrational numbers, and complex numbers. Here we are chiefly concerned with the ternary representation of integers.

For example, 1729 in ternary is 2101001. (Using the base conversion template {{from base 10|1729|3}} we get 2101001.)

For numbers ${\displaystyle \scriptstyle n\,}$ written in base 3, i.e. ${\displaystyle \scriptstyle (n)_{3}\,}$, see A007089. For ${\displaystyle 3^{n}}$, see A000244.

From time to time it has been proposed that computers should use the ternary (in particular balanced ternary) rather than the binary numeral system, but, as sensible and well-thought out as these proposals are, they have about as much chance as the adoption of the duodecimal numeral system for human use or the establishment of Esperanto as the international language.

Divisibility

Integers are divisible by 2 if the sum of digits in base 3 representation is even (this is similar to the divisibility test for 9 in base 10). For example, 2101 is an even number, as we verify that 2 + 1 + 0 + 1 = 11 (or 4 in base 10). In fact, 2101 means 64, or ${\displaystyle 2^{6}}$; since ${\displaystyle 2^{2n}\equiv 1\mod 3}$, all even-indexed powers of 2 end with a 1 in base 3.

Integers are divisible by ${\displaystyle 3^{k}}$ if the last ${\displaystyle k}$ digits are 0 (this is similar to the tests for divisibility by 100, 1000, 10000, etc., in base 10). For example, 2101000 is divisible by 100 (1728 is divisible by 27).

Sequences

A000244 Powers of 3.

{1, 3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049, 177147, 531441, 1594323, 4782969, 14348907, 43046721, 129140163, 387420489, 1162261467, 3486784401, 10460353203, ...}

A007089 Nonnegative integers in base 3.

{0, 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102, 110, 111, 112, 120, 121, 122, 200, 201, 202, 210, 211, 212, 220, 221, 222, 1000, 1001, 1002, 1010, 1011, 1012, 1020, 1021, 1022, ...}

A081604 String-length of ternary representation of n.

{1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, ...}

A?????? Sum of digits of ternary representation of n.

{, ...}

A094345 Sum of all digits in ternary expansions of 0, ..., n.

{0, 1, 3, 4, 6, 9, 11, 14, 18, 19, 21, 24, 26, 29, 33, 36, 40, 45, 47, 50, 54, 57, 61, 66, 70, 75, 81, 82, 84, 87, 89, 92, 96, 99, 103, 108, 110, 113, 117, 120, 124, 129, 133, ...}

A006287 Sum of squares of digits of ternary representation of n.

{0, 1, 4, 1, 2, 5, 4, 5, 8, 1, 2, 5, 2, 3, 6, 5, 6, 9, 4, 5, 8, 5, 6, 9, 8, 9, 12, 1, 2, 5, 2, 3, 6, 5, 6, 9, 2, 3, 6, 3, 4, 7, 6, 7, 10, 5, 6, 9, 6, 7, 10, 9, 10, 13, 4, 5, 8, ...}

Sequences (ternary digit 0)

A?????? Number of 0's in ternary (base 3) expansion of n.

{, ...}

A032924 Numbers whose ternary expansion contains no 0.

{1, 2, 4, 5, 7, 8, 13, 14, 16, 17, 22, 23, 25, 26, 40, 41, 43, 44, 49, 50, 52, 53, 67, 68, 70, 71, 76, 77, 79, 80, 121, 122, 124, 125, 130, 131, 133, 134, 148, 149, 151, 152, ...}

A081608 Number of numbers <= n having no 0 in their ternary representation.

{0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 6, 6, 6, 7, 8, 8, 9, 10, 10, 10, 10, 10, 11, 12, 12, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 16, 16, 17, 18, 18, 18, 18, ...}

A081605 Numbers having at least one 0 in their ternary representation.

{0, 3, 6, 9, 10, 11, 12, 15, 18, 19, 20, 21, 24, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 42, 45, 46, 47, 48, 51, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, ...}

A081607 Number of numbers <= n having at least one 0 in their ternary representation.

{1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 5, 6, 7, 7, 7, 8, 8, 8, 9, 10, 11, 12, 12, 12, 13, 13, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 26, 27, 27, 27, 28, 29, 30, 31, ...}

Sequences (ternary digit 1)

A062756 Number of 1's in ternary (base 3) expansion of n.

{0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 2, 3, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 3, 4, 3, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 0, 1, 0, 1, ...}

A005823 Numbers whose ternary expansion contains no 1's.

{0, 2, 6, 8, 18, 20, 24, 26, 54, 56, 60, 62, 72, 74, 78, 80, 162, 164, 168, 170, 180, 182, 186, 188, 216, 218, 222, 224, 234, 236, 240, 242, 486, 488, 492, 494, 504, 506, ...}

A023692 Numbers with a single 1 in their ternary expansion.

{1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25, 27, 29, 33, 35, 45, 47, 51, 53, 55, 57, 59, 61, 63, 65, 69, 71, 73, 75, 77, 79, 81, 83, 87, 89, 99, 101, 105, 107, 135, 137, 141, ...}

A132141 Numbers whose ternary representation begins with 1.

{1, 3, 4, 5, 9, 10, 11, 12, 13, 14, 15, 16, 17, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 81, 82, 83, 84, 85, ...}

A081606 Numbers having at least one 1 in their ternary representation.

{1, 3, 4, 5, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 22, 23, 25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, ...}

A081609 Number of numbers <= n having at least one 1 in their ternary representation.

{0, 1, 1, 2, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 15, 15, 16, 17, 18, 18, 19, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, ...}

Sequences (ternary digit 2)

A081603 Number of 2's in ternary representation of n.

{0, 0, 1, 0, 0, 1, 1, 1, 2, 0, 0, 1, 0, 0, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 3, 0, 0, 1, 0, 0, 1, 1, 1, 2, 0, 0, 1, 0, 0, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 3, 1, 1, 2, 1, ...}
 ?????????? SAME DEFINITIONS, DIFFERENT SEQUENCES ??????????

A104406 Number of numbers <= n having no 2 in ternary representation.

:{1, 1, 2, 3, 3, 3, 3, 3, 4, 5, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, 9, 10, 11, 11, 11, 11, 11, 12, 13, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, ...}

A081611 Number of numbers <= n having no 2 in their ternary representation.

:{1, 2, 2, 3, 4, 4, 4, 4, 4, 5, 6, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 10, 10, 11, 12, 12, 12, 12, 12, 13, 14, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, ...}



A157671 Numbers whose ternary representation begins with 2.

{2, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 162, 163, 164, 165, ...}

A074940 Numbers having at least one 2 in their ternary representation.

{2, 5, 6, 7, 8, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 29, 32, 33, 34, 35, 38, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, ...}

A081610 Number of numbers <= n having at least one 2 in their ternary representation.

{0, 0, 1, 1, 1, 2, 3, 4, 5, 5, 5, 6, 6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 19, 20, 20, 20, 21, 22, 23, 24, 24, 24, 25, 25, 25, 26, 27, 28, 29, 30, 31, 32, ...}

Sequences (ternary digits 1 and 2)

A125292 Numbers having either no ones or no twos in their ternary representation.

{1, 2, 3, 4, 6, 8, 9, 10, 12, 13, 18, 20, 24, 26, 27, 28, 30, 31, 36, 37, 39, 40, 54, 56, 60, 62, 72, 74, 78, 80, 81, 82, 84, 85, 90, 91, 93, 94, 108, 109, 111, 112, 117, 118, ...}

A125293 Numbers with at least one 1 and one 2 in ternary representation.

{5, 7, 11, 14, 15, 16, 17, 19, 21, 22, 23, 25, 29, 32, 33, 34, 35, 38, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 57, 58, 59, 61, 63, 64, 65, 66, 67, 68, 69, 70, ...}

Other sequences

A037078 In ternary expansion of n, reading from right to left, digits occur in order ...,0,1,2,0,1,2,...

{0, 1, 2, 3, 7, 11, 21, 34, 65, 102, 196, 308, 588, 925, 1766, 2775, 5299, 8327, 15897, 24982, 47693, 74946, 143080, 224840, 429240, 674521, 1287722, 2023563, 3863167, 6070691, ...}

A037079 In ternary expansion of n, reading from left to right, digits occur in order ...,0,1,2,0,1,2,...

{0, 1, 2, 5, 6, 15, 19, 46, 59, 140, 177, 420, 532, 1261, 1598, 3785, 4794, 11355, 14383, 34066, 43151, 102200, 129453, 306600, 388360, 919801, 1165082, 2759405, 3495246, ...}

A037080 In ternary expansion of n, reading from right to left, successive runs of the digits occur in order ...,0,1,2,0,1,2,...

{0, 1, 2, 3, 4, 7, 8, 9, 11, 12, 13, 21, 22, 25, 26, 27, 29, 34, 35, 36, 38, 39, 40, 63, 65, 66, 67, 75, 76, 79, 80, 81, 83, 88, 89, 102, 103, 106, 107, 108, 110, 115, 116, 117, ...}

A037081 In ternary expansion of n, reading from left to right, successive runs of the digits occur in order ...,0,1,2,0,1,2,...

{0, 1, 2, 4, 5, 6, 8, 13, 14, 15, 17, 18, 19, 24, 26, 40, 41, 42, 44, 45, 46, 51, 53, 54, 55, 58, 59, 72, 73, 78, 80, 121, 122, 123, 125, 126, 127, 132, 134, 135, 136, 139, 140, ...}

A064150 Numbers divisible by the sum of their ternary digits.

{1, 2, 3, 4, 6, 8, 9, 10, 12, 15, 16, 18, 20, 21, 24, 25, 27, 28, 30, 32, 33, 35, 36, 39, 40, 45, 48, 54, 56, 57, 60, 63, 64, 65, 72, 75, 77, 78, 80, 81, 82, 84, 87, 88, 90, 92, ...}

Sequences (primes and composites)

A001363 Primes in ternary.

{2, 10, 12, 21, 102, 111, 122, 201, 212, 1002, 1011, 1101, 1112, 1121, 1202, 1222, 2012, 2021, 2111, 2122, 2201, 2221, 10002, 10022, 10121, 10202, 10211, 10222, 11001, 11012, ...}

A174976 Primes which have an equal number of 0,1,2 in their Base_3 expansion.

{11, 19, 6719, 6791, 6793, 6857, 6883, 6911, 6947, 6959, 6983, 6991, 7001, 7013, 7027, 7039, 7151, 7187, 7193, 7243, 7247, 7369, 7433, 7477, 7487, 7499, 7517, 7559, 7607, ...}

A?????? Primes which have an equal number of 0,1,2 in their Base_3 expansion (shown in base 3).

{102, 201, 100012212, 100022112, 100022121, 100101222, 100102221, ...}

A?????? Composites in ternary.

{, ...}

A?????? Composites which have an equal number of 0,1,2 in their Base_3 expansion.

{, ...}