Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Ternary numeral system
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Base-3 numeral system}} {{Use dmy dates|date=May 2019|cs1-dates=y}} {{Table Numeral Systems}} A '''ternary''' {{IPAc-en|ˈ|t|ɜr|n|ər|i}} [[numeral system]] (also called '''base 3''' or '''trinary'''<ref name="Kindra2022">{{Cite journal |last1=Kindra |first1=Vladimir |last2=Rogalev |first2=Nikolay |last3=Osipov |first3=Sergey |last4=Zlyvko |first4=Olga |last5=Naumov |first5=Vladimir |date=2022 |title=Research and Development of Trinary Power Cycles |journal=Inventions |language=en |volume=7 |issue=3 |pages=56 |doi=10.3390/inventions7030056 |doi-access=free |issn=2411-5134}}</ref>) has [[3 (number)|three]] as its [[radix|base]]. Analogous to a [[bit]], a ternary [[numerical digit|digit]] is a '''trit''' ('''tri'''nary dig'''it'''). One trit is equivalent to [[binary logarithm|log<sub>2</sub>]] 3 (about 1.58496) bits of [[Units of information|information]]. Although ''ternary'' most often refers to a system in which the three digits are all non–negative numbers; specifically {{num|0}}, {{num|1}}, and {{num|2}}, the adjective also lends its name to the [[balanced ternary]] system; comprising the digits [[−1]], 0 and +1, used in comparison logic and [[ternary computer]]s. == Comparison to other bases == Representations of [[integer number]]s in ternary do not get uncomfortably lengthy as quickly as in [[binary numeral system|binary]]. For example, [[decimal]] [[365 (number)|365]]{{sub|(10)}} or [[senary]] {{gaps|1|405}}{{sub|(6)}} corresponds to binary {{gaps|1|0110|1101}}{{sub|(2)}} (nine [[bit]]s) and to ternary {{gaps|111|112}}{{sub|(3)}} (six digits). However, they are still far less compact than the corresponding representations in bases such as [[decimal]] – see below for a compact way to codify ternary using nonary (base 9) and [[septemvigesimal]] (base 27). {| class="wikitable" style="float:right; text-align:center" |+ A ternary [[multiplication table]] |- ! × || '''1'''|| '''2''' || '''10''' || '''11''' || '''12''' || '''20''' || '''21''' || '''22''' || '''100''' |- ! '''1''' | 1 || 2 || 10 || 11 || 12 || 20 || 21 || 22 || 100 |- ! '''2''' | 2 || 11 || 20 || 22 || 101 || 110 || 112 || 121 || 200 |- ! '''10''' | 10 || 20 || 100 || 110 || 120 || 200 || 210 || 220 || 1,000 |- ! '''11''' | 11 || 22 || 110 || 121 || 202 || 220 || 1,001 || 1,012 || 1,100 |- ! '''12''' | 12 || 101 || 120 || 202 || 221 || 1,010 | 1,022 || 1,111 || 1,200 |- ! '''20''' | 20 || 110 || 200 || 220 || 1,010 || 1,100 | 1,120 || 1,210 || 2,000 |- ! '''21''' | 21 || 112 || 210 || 1,001 || 1,022 || 1,120 | 1,211 || 2,002 || 2,100 |- ! '''22''' | 22 || 121 || 220 || 1,012 || 1,111 || 1,210 | 2,002 || 2,101 || 2,200 |- ! '''100''' | 100 || 200 || 1,000 || 1,100 || 1,200 || 2,000 | 2,100 || 2,200 || 10,000 |} :{| class="wikitable" |+ '''Numbers from 0 to 3<sup>3</sup> − 1 in standard ternary''' |- align="center" ! Ternary | 0 || 1 || 2 || 10 || 11 || 12 || 20 || 21 || 22 |- align="center" ! Binary | 0 || 1 || 10 || 11 || 100 || 101 || 110 || 111 || {{gaps|1|000}} |- align="center" ! Senary | 0 || 1 || 2 || 3 || 4 || 5 || 10 || 11 || 12 |- align="center" ! Decimal ! 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 |- |colspan=10 style="background-color:white;"| |- align="center" ! Ternary | 100 || 101 || 102 || 110 || 111 || 112 || 120 || 121 || 122 |- align="center" ! Binary | 1001 || 1010 || 1011 || 1100 || 1101 || 1110 || 1111 | {{gaps|1|0000}} || {{gaps|1|0001}} |- align="center" ! Senary | 13 || 14 || 15 || 20 || 21 || 22 || 23 || 24 || 25 |- align="center" ! Decimal ! 9 ||10 || 11 || 12|| 13 || 14 || 15 || 16 || 17 |- |colspan=10 style="background-color:white;"| |- align="center" ! Ternary | 200 || 201 || 202 || 210 || 211 || 212 || 220 || 221 || 222 |- align="center" ! Binary | {{gaps|1|0010}} || {{gaps|1|0011}} || {{gaps|1|0100}} || {{gaps|1|0101}} || {{gaps|1|0110}} | {{gaps|1|0111}} || {{gaps|1|1000}} || {{gaps|1|1001}} || {{gaps|1|1010}} |- align="center" ! Senary | 30 || 31 || 32 || 33 || 34 || 35 || 40 || 41 || 42 |- align="center" ! Decimal ! 18 || 19 || 20 || 21 || 22 || 23 || 24 || 25 || 26 |} : :{| class="wikitable" |+ '''Powers of 3 in ternary''' |- align="center" ! Ternary | 1 || 10 || 100 || {{gaps|1|000}} || {{gaps|10|000}} |- align="center" ! Binary | 1 || 11 || 1001 || {{gaps|1|1011}} || {{gaps|101|0001}} |- align="center" ! Senary | 1 || 3 || 13 || 43 || 213 |- align="center" ! Decimal | 1 || 3 || 9 || 27 || 81 |- align="center" ! Power ! {{big|3}}{{sup|0}} || {{big|3}}{{sup|1}} || {{big|3}}{{sup|2}} ! {{big|3}}{{sup|3}} || {{big|3}}{{sup|4}} |- |colspan=10 style="background-color:white;"| |- align="center" ! Ternary | {{gaps|100|000}} || {{gaps|1|000|000}} || {{gaps|10|000|000}} | {{gaps|100|000|000}} || {{gaps|1|000|000|000}} |- align="center" ! Binary | {{gaps|1111|0011}} || {{gaps|10|1101|1001}} || {{gaps|1000|1000|1011}} | {{gaps|1|1001|1010|0001}} || {{gaps|100|1100|1110|0011}} |- align="center" ! Senary | {{gaps|1|043}} || {{gaps|3|213}} || {{gaps|14|043}} || {{gaps|50|213}} || {{gaps|231|043}} |- align="center" ! Decimal | 243 || 729 || {{gaps|2|187}} || {{gaps|6|561}} || {{gaps|19|683}} |- align="center" ! Power ! {{big|3}}{{sup|5}} || {{big|3}}{{sup|6}} || {{big|3}}{{sup|7}} ! {{big|3}}{{sup|8}} || {{big|3}}{{sup|9}} |} As for [[rational number]]s, ternary offers a convenient way to represent {{sfrac|1|3}} as same as senary (as opposed to its cumbersome representation as an infinite string of [[recurring decimal|recurring digits]] in decimal); but a major drawback is that, in turn, ternary does not offer a finite representation for {{sfrac|1|2}} (nor for {{sfrac|1|4}}, {{sfrac|1|8}}, etc.), because [[2 (number)|2]] is not a [[Prime number|prime]] [[factorization|factor]] of the base; as with base two, one-tenth (decimal{{sfrac|1|10}}, senary {{sfrac|1|14}}) is not representable exactly (that would need e.g. decimal); nor is one-sixth (senary {{sfrac|1|10}}, decimal {{sfrac|1|6}}). :{| class="wikitable" |+ '''Fractions in ternary''' |- align="center" ! Fraction | '''{{sfrac|1|2}}''' || '''{{sfrac|1|3}}''' || '''{{sfrac|1|4}}''' || '''{{sfrac|1|5}}''' || '''{{sfrac|1|6}}''' || '''{{sfrac|1|7}}''' || '''{{sfrac|1|8}}''' || '''{{sfrac|1|9}}''' || '''{{sfrac|1|10}}''' || '''{{sfrac|1|11}}''' || '''{{sfrac|1|12}}''' || '''{{sfrac|1|13}}''' |- align="center" ! Ternary | 0.{{overline|1}} || 0.1 || 0.{{overline|02}} || 0.{{overline|0121}} || 0.0{{overline|1}} || 0.{{overline|010212}} || 0.{{overline|01}} || 0.01 || 0.{{overline|0022}} || 0.{{overline|00211}} || 0.0{{overline|02}} || 0.{{overline|002}} |- align="center" ! Binary | 0.1 || 0.{{overline|01}} || 0.01 || 0.{{overline|0011}} || 0.0{{overline|01}} || 0.{{overline|001}} || 0.001 || 0.{{overline|000111}} || 0.0{{overline|0011}} || 0.{{overline|0001011101}} || 0.00{{overline|01}} || 0.{{overline|000100111011}} |- align="center" ! Senary | 0.3 || 0.2 || 0.13 || 0.{{overline|1}} || 0.1 || 0.{{overline|05}} || 0.043 || 0.04 || 0.0{{overline|3}} || 0.{{overline|0313452421}} || 0.03 || 0.{{overline|024340531215}} |- align="center" ! Decimal ! 0.5 || 0.{{overline|3}} || 0.25 || 0.2 || 0.1{{overline|6}} || 0.{{overline|142857}} || 0.125 ! 0.{{overline|1}} || 0.1 || 0.{{overline|09}} || 0.08{{overline|3}} || 0.{{overline|076923}} |} === Sum of the digits in ternary as opposed to binary === The value of a binary number with ''n'' bits that are all 1 is {{math|2<sup>''n''</sup> − 1}}. Similarly, for a number ''N''(''b'', ''d'') with base ''b'' and ''d'' digits, all of which are the maximal digit value {{math|''b'' − 1}}, we can write: : {{math|1=''N''(''b'', ''d'') = (''b'' − 1)''b''<sup>''d''−1</sup> + (''b'' − 1)''b''<sup>''d''−2</sup> + … + (''b'' − 1)''b''<sup>1</sup> + (''b'' − 1)''b''<sup>0</sup>,}} : {{math|1={{white|''N''(''b'', ''d'')}} = (''b'' − 1)(''b''<sup>''d''−1</sup> + ''b''<sup>''d''−2</sup> + … + ''b''<sup>1</sup> + 1),}} : {{math|1={{white|''N''(''b'', ''d'')}} = (''b'' − 1)''M''}}. : {{math|1=''bM'' = ''b''<sup>''d''</sup> + ''b''<sup>''d''−1</sup> + … + ''b''<sup>2</sup> + ''b''<sup>1</sup>}} and : {{math|1=−''M'' = −''b''<sup>''d''−1</sup> − ''b''<sup>''d''−2</sup> − ... − b<sup>1</sup> − 1}}, so : {{math|1=''bM'' − ''M'' = ''b''<sup>''d''</sup> − 1}}, or : {{math|1=''M'' = {{sfrac|''b''<sup>''d''</sup> − 1|''b'' − 1}}.}} Then : {{math|1=''N''(''b'', ''d'') = (''b'' − 1)''M'',}} : {{math|1={{white|''N''(''b'', ''d'')}} = {{sfrac|(''b'' − 1)(''b''<sup>''d''</sup> − 1)|''b'' − 1}},}} : {{math|1={{white|''N''(''b'', ''d'')}} = ''b''<sup>''d''</sup> − 1.}} For a three-digit ternary number, {{math|1=''N''(3, 3) = 3<sup>3</sup> − 1 = 26 = 2 × 3<sup>2</sup> + 2 × 3<sup>1</sup> + 2 × 3<sup>0</sup> = 18 + 6 + 2}}. === Compact ternary representation: base 9 and 27 === {| class="wikitable" style="float:right; text-align:center" |+ Comparison between ternary and nonary |- ! ternary || nonary |- | 00 || 0 |- | 01 || 1 |- | 02 || 2 |- | 10 || 3 |- | 11 || 4 |- | 12 || 5 |- | 20 || 6 |- | 21 || 7 |- | 22 || 8 |} '''Nonary''' {{IPAc-en|ˈ|n|ɒ|n|ər|i}} (base 9, each digit is two ternary digits) or [[septemvigesimal]] (base 27, each digit is three ternary digits) can be used for compact representation of ternary, similar to how [[octal]] and [[hexadecimal]] systems are used in place of [[binary numeral system|binary]]. ==Practical usage== [[File:fewest_weights_balance_puzzle.svg|thumb|Use of ternary numbers to balance an unknown integer weight from 1 to 40 kg with weights of 1, 3, 9 and 27 kg (4 ternary digits actually gives 3<sup>4</sup> = 81 possible combinations: −40 to +40, but only the positive values are useful)]] In certain analog logic, the state of the circuit is often expressed ternary. This is most commonly seen in [[CMOS]] circuits, and also in [[transistor–transistor logic]] with [[Push–pull output|totem-pole output]]. The output is said to either be low ([[Ground (electricity)|grounded]]), high, or open ([[High impedance|high-''Z'']]). In this configuration the output of the circuit is actually not connected to any [[voltage]] reference at all. Where the signal is usually grounded to a certain reference, or at a certain voltage level, the state is said to be high [[Electrical impedance|impedance]] because it is open and serves its own reference. Thus, the actual voltage level is sometimes unpredictable. A rare "ternary point" in common use is for defensive statistics in American [[baseball]] (usually just for [[Pitcher|pitchers]]), to denote fractional parts of an inning. Since the team on offense is allowed three [[Out (baseball)|outs]], each out is considered one third of a defensive inning and is denoted as '''.1'''. For example, if a player pitched all of the 4th, 5th and 6th innings, plus achieving 2 outs in the 7th inning, his [[innings pitched]] column for that game would be listed as '''3.2''', the equivalent of {{frac|3|2|3}} (which is sometimes used as an alternative by some record keepers). In this usage, only the fractional part of the number is written in ternary form.<ref>{{cite web |url=https://www.blessyouboys.com/2019/1/9/18172095/baseball-stats-for-beginners-earned-run-average-field-independent-pitching-explained |title=A complete beginner's guide to baseball stats: Pitching statistics, and what they mean |author= Ashley MacLennan |date=Jan 9, 2019 |work=Bless You Boys |access-date=July 30, 2020}}</ref><ref>{{cite web |url=https://www.mlb.com/stats/team/pitching/innings-pitched?split=rp |title=Stats - Team - Pitching |publisher=MLB (Major League Baseball) |access-date=July 30, 2020}}</ref> Ternary numbers can be used to convey self-similar structures like the [[Sierpiński triangle|Sierpinski triangle]] or the [[Cantor set]] conveniently. Additionally, it turns out that the ternary representation is useful for defining the Cantor set and related point sets, because of the way the Cantor set is constructed. The Cantor set consists of the points from 0 to 1 that have a ternary expression that does not contain any instance of the digit 1.<ref name="Soltanifar_2006_1"/><ref name="Soltanifar_2006_2"/> Any terminating expansion in the ternary system is equivalent to the expression that is identical up to the term preceding the last non-zero term followed by the term one less than the last non-zero term of the first expression, followed by an infinite tail of twos. For example: 0.1020 is equivalent to 0.1012222... because the expansions are the same until the "two" of the first expression, the two was decremented in the second expansion, and trailing zeros were replaced with trailing twos in the second expression. Ternary is the integer base with the lowest [[radix economy]], followed closely by [[Binary numeral system|binary]] and [[Quaternary numeral system|quaternary]]. This is due to its proximity to the [[mathematical constant]] [[e (mathematical constant)|''e'']]. It has been used for some computing systems because of this efficiency. It is also used to represent three-option ''trees'', such as phone menu systems, which allow a simple path to any branch. A form of [[redundant binary representation]] called a binary signed-digit number system, a form of [[signed-digit representation]], is sometimes used in low-level software and hardware to accomplish fast addition of integers because it can eliminate [[Carry (arithmetic)|carries]].<ref name="Phatak_1994"/> ===Binary-coded ternary=== Simulation of ternary computers using binary computers, or interfacing between ternary and binary computers, can involve use of binary-coded ternary (BCT) numbers, with two or three bits used to encode each trit.<ref name="Frieder_1975"/><ref name="Parhami_2013"/> BCT encoding is analogous to [[binary-coded decimal]] (BCD) encoding. If the trit values 0, 1 and 2 are encoded 00, 01 and 10, conversion in either direction between binary-coded ternary and binary can be done in [[Time complexity#Logarithmic time|logarithmic time]].<ref name="Jones_2016_1"/> A library of [[C (programming language)|C code]] supporting BCT arithmetic is available.<ref name="Jones_2016_2"/> ===Tryte=== Some [[ternary computer]]s such as the [[Setun]] defined a '''tryte''' to be six trits<ref name="Impagliazzo_2006"/> or approximately 9.5 [[bit]]s (holding more information than the ''de facto'' [[Binary number|binary]] [[byte]]).<ref name="Brousentsov_2010"/> ==See also== * [[Qutrit]] * [[Setun]], a [[ternary computer]] * [[Ternary logic]] * ''[[Taixuanjing]]'' ==References== {{reflist|refs= <ref name="Soltanifar_2006_1">{{cite journal |author-first=Mohsen |author-last=Soltanifar |title=On A sequence of cantor Fractals |journal=Rose Hulman Undergraduate Mathematics Journal |volume=7 |number=1 |id=Paper 9 |date=2006}}</ref> <ref name="Soltanifar_2006_2">{{cite journal |author-first=Mohsen |author-last=Soltanifar |title=A Different Description of A Family of Middle–α Cantor Sets |journal=American Journal of Undergraduate Research |volume=5 |number=2 |pages=9–12 |date=2006}}</ref> <ref name="Phatak_1994">{{cite journal |author-last1=Phatak |author-first1=D. S. |author-last2=Koren |author-first2=I. |title=Hybrid signed–digit number systems: a unified framework for redundant number representations with bounded carry propagation chains |journal=[[IEEE Transactions on Computers]] |date=1994 |volume=43 |issue=8 |pages=880–891 |doi=10.1109/12.295850 |url=http://www.cs.umbc.edu/~phatak/publications/hsdtrc.pdf|citeseerx=10.1.1.352.6407 }}</ref> <ref name="Frieder_1975">{{cite journal |author-last1=Frieder |author-first1=Gideon |author-last2=Luk |author-first2=Clement |title=Algorithms for Binary Coded Balanced and Ordinary Ternary Operations |journal=[[IEEE Transactions on Computers]] |date=February 1975 |volume=C-24 |issue=2 |pages=212–215 |doi=10.1109/T-C.1975.224188|s2cid=38704739 }}</ref> <ref name="Parhami_2013">{{cite book |author-first1=Behrooz |author-last1=Parhami |author-first2=Michael |author-last2=McKeown |title=2013 Asilomar Conference on Signals, Systems and Computers |chapter=Arithmetic with binary-encoded balanced ternary numbers |date=2013-11-03<!-- /06 --> |location=Pacific Grove, California, US |pages=1130–1133|doi=10.1109/ACSSC.2013.6810470 |isbn=978-1-4799-2390-8 |s2cid=9603084 }}</ref> <ref name="Jones_2016_1">{{cite web |author-first=Douglas W. |author-last=Jones |url=http://www.cs.uiowa.edu/~jones/ternary/bct.shtml |title=Binary Coded Ternary and its Inverse |date=June 2016}}</ref> <ref name="Jones_2016_2">{{cite web |author-first1=Douglas W. |author-last1=Jones |url=http://www.cs.uiowa.edu/~jones/ternary/libtern.shtml |title=Ternary Data Types for C Programmers |date=2015-12-29}}</ref> <ref name="Impagliazzo_2006">{{cite conference|url=https://books.google.com/books?id=-jSqCAAAQBAJ |title=Perspectives on Soviet and Russian Computing |conference=First IFIP WG 9.7 Conference, SoRuCom 2006 |location=Petrozavodsk, Russia |date=2006 |author-last1=Impagliazzo |author-first1=John |author-last2=Proydakov |author-first2=Eduard |publisher=[[Springer (publisher)|Springer]] |isbn=978-3-64222816-2}}</ref> <ref name="Brousentsov_2010">{{cite web |author-last1=Brousentsov |author-first1=N. P. |author-last2=Maslov |author-first2=S. P. |author-last3=Ramil Alvarez |author-first3=J. |author-last4=Zhogolev |author-first4=E. A. |title=Development of ternary computers at Moscow State University |url=http://www.computer-museum.ru/english/setun.htm |access-date=2010-01-20}}</ref> }} ==Further reading== * {{Cite journal |author-first=Brian |author-last=Hayes |author-link=Brian Hayes (scientist) |title=Third base |journal=[[American Scientist]] |publisher=[[Sigma Xi]], the Scientific Research Society |date=November–December 2001 |volume=89 |issue=6 |pages=490–494 |doi=10.1511/2001.40.3268 |url=http://bit-player.org/wp-content/extras/bph-publications/AmSci-2001-11-Hayes-ternary.pdf |access-date=2020-04-12 |url-status=live |archive-url=https://web.archive.org/web/20191030114823/http://bit-player.org/wp-content/extras/bph-publications/AmSci-2001-11-Hayes-ternary.pdf |archive-date=2019-10-30}} ==External links== * [http://www.washingtonart.net/whealton/ternary.html Ternary Arithmetic] {{Webarchive|url=https://web.archive.org/web/20110514130533/http://www.washingtonart.net/whealton/ternary.html |date=2011-05-14 }} * [http://www.mortati.com/glusker/fowler/index.htm The ternary calculating machine of Thomas Fowler] * [http://www.mathsisfun.com/numbers/convert-base.php?to=ternary Ternary Base Conversion]{{snd}}includes fractional part, from Maths Is Fun * [http://www.americanscientist.org/issues/pub/third-base/3 Gideon Frieder's replacement ternary numeral system] * [http://sresearch.scienceontheweb.net/visualization.php Visualization of ternary numeral system] {{Data types}} {{DEFAULTSORT:Ternary Numeral System}} [[Category:Computer arithmetic]] [[Category:Positional numeral systems]] [[Category:Ternary computers]]
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Big
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite web
(
edit
)
Template:Data types
(
edit
)
Template:Frac
(
edit
)
Template:Gaps
(
edit
)
Template:IPAc-en
(
edit
)
Template:Math
(
edit
)
Template:Num
(
edit
)
Template:Overline
(
edit
)
Template:Reflist
(
edit
)
Template:Sfrac
(
edit
)
Template:Short description
(
edit
)
Template:Snd
(
edit
)
Template:Sub
(
edit
)
Template:Sup
(
edit
)
Template:Table Numeral Systems
(
edit
)
Template:Use dmy dates
(
edit
)
Template:Webarchive
(
edit
)
Search
Search
Editing
Ternary numeral system
Add topic