Ternary numeral system

A ternary /ˈtɜːrnəri/ numeral system (also called base 3 or trinary[1]) has three as its base. Analogous to a bit, a ternary digit is a trit (trinary digit). One trit is equivalent to log2 3 (about 1.58496) bits of information.

Although ternary most often refers to a system in which the three digits are all non–negative numbers; specifically 0, 1, and 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 computers.

Comparison to other bases

Representations of integer numbers in ternary do not get uncomfortably lengthy as quickly as in binary. For example, decimal 365(10) or senary 1405(6) corresponds to binary 101101101(2) (nine bits) and to ternary 111112(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).

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 1000
11 11 22 110 121 202 220 1001 1012 1100
12 12 101 120 202 221 1010 1022 1111 1200
20 20 110 200 220 1010 1100 1120 1210 2000
21 21 112 210 1001 1022 1120 1211 2002 2100
22 22 121 220 1012 1111 1210 2002 2101 2200
100 100 200 1000 1100 1200 2000 2100 2200 10000
Numbers from 0 to 33 − 1 in standard ternary
Ternary 0 1 2 10 11 12 20 21 22
Binary 0 1 10 11 100 101 110 111 1000
Senary 0 1 2 3 4 5 10 11 12
Decimal 0 1 2 3 4 5 6 7 8
Ternary 100 101 102 110 111 112 120 121 122
Binary 1001 1010 1011 1100 1101 1110 1111 10000 10001
Senary 13 14 15 20 21 22 23 24 25
Decimal 9 10 11 12 13 14 15 16 17
Ternary 200 201 202 210 211 212 220 221 222
Binary 10010 10011 10100 10101 10110 10111 11000 11001 11010
Senary 30 31 32 33 34 35 40 41 42
Decimal 18 19 20 21 22 23 24 25 26
Powers of 3 in ternary
Ternary 1 10 100 1000 10000
Binary 1 11 1001 11011 1010001
Senary 1 3 13 43 213
Decimal 1 3 9 27 81
Power 30 31 32 33 34
Ternary 100000 1000000 10000000 100000000 1000000000
Binary 11110011 1011011001 100010001011 1100110100001 100110011100011
Senary 1043 3213 14043 50213 231043
Decimal 243 729 2187 6561 19683
Power 35 36 37 38 39

As for rational numbers, ternary offers a convenient way to represent 1/3 as same as senary (as opposed to its cumbersome representation as an infinite string of recurring digits in decimal); but a major drawback is that, in turn, ternary does not offer a finite representation for 1/2 (nor for 1/4, 1/8, etc.), because 2 is not a prime factor of the base; as with base two, one-tenth (decimal1/10, senary 1/14) is not representable exactly (that would need e.g. decimal); nor is one-sixth (senary 1/10, decimal 1/6).

Fractions in ternary
Fraction 1/2 1/3 1/4 1/5 1/6 1/7 1/8 1/9 1/10 1/11 1/12 1/13
Ternary 0.1 0.1 0.02 0.0121 0.01 0.010212 0.01 0.01 0.0022 0.00211 0.002 0.002
Binary 0.1 0.01 0.01 0.0011 0.001 0.001 0.001 0.000111 0.00011 0.0001011101 0.0001 0.000100111011
Senary 0.3 0.2 0.13 0.1 0.1 0.05 0.043 0.04 0.03 0.0313452421 0.03 0.024340531215
Decimal 0.5 0.3 0.25 0.2 0.16 0.142857 0.125 0.1 0.1 0.09 0.083 0.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 2n − 1.

Similarly, for a number N(b, d) with base b and d digits, all of which are the maximal digit value b − 1, we can write:

N(b, d) = (b − 1)bd−1 + (b − 1)bd−2 + … + (b − 1)b1 + (b − 1)b0,
N(b, d) = (b − 1)(bd−1 + bd−2 + … + b1 + 1),
N(b, d) = (b − 1)M.
bM = bd + bd−1 + … + b2 + b1 and
M = −bd−1 − bd−2 − ... − b1 − 1, so
bM − M = bd − 1, or
M = bd − 1/b − 1.

Then

N(b, d) = (b − 1)M,
N(b, d) = (b − 1)(bd − 1)/b − 1,
N(b, d) = bd − 1.

For a three-digit ternary number, N(3, 3) = 33 − 1 = 26 = 2 × 32 + 2 × 31 + 2 × 30 = 18 + 6 + 2.

Compact ternary representation: base 9 and 27

Nonary (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.

Practical usage

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 34 = 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 totem-pole output. The output is said to either be low (grounded), high, or open (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 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 pitchers), to denote fractional parts of an inning. Since the team on offense is allowed three 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 3+23 (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.[2][3]

Ternary numbers can be used to convey self-similar structures like the 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.[4][5] 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 and quaternary. This is due to its proximity to the 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 carries.[6]

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.[7][8] 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 logarithmic time.[9] A library of C code supporting BCT arithmetic is available.[10]

Tryte

Some ternary computers such as the Setun defined a tryte to be six trits[11] or approximately 9.5 bits (holding more information than the de facto binary byte).[12]

See also

References

  1. ^ Kindra, Vladimir; Rogalev, Nikolay; Osipov, Sergey; Zlyvko, Olga; Naumov, Vladimir (2022). "Research and Development of Trinary Power Cycles". Inventions. 7 (3): 56. doi:10.3390/inventions7030056. ISSN 2411-5134.
  2. ^ Ashley MacLennan (2019-01-09). "A complete beginner's guide to baseball stats: Pitching statistics, and what they mean". Bless You Boys. Retrieved 2020-07-30.
  3. ^ "Stats - Team - Pitching". MLB (Major League Baseball). Retrieved 2020-07-30.
  4. ^ Soltanifar, Mohsen (2006). "On A sequence of cantor Fractals". Rose Hulman Undergraduate Mathematics Journal. 7 (1). Paper 9.
  5. ^ Soltanifar, Mohsen (2006). "A Different Description of A Family of Middle–α Cantor Sets". American Journal of Undergraduate Research. 5 (2): 9–12.
  6. ^ Phatak, D. S.; Koren, I. (1994). "Hybrid signed–digit number systems: a unified framework for redundant number representations with bounded carry propagation chains" (PDF). IEEE Transactions on Computers. 43 (8): 880–891. CiteSeerX 10.1.1.352.6407. doi:10.1109/12.295850.
  7. ^ Frieder, Gideon; Luk, Clement (February 1975). "Algorithms for Binary Coded Balanced and Ordinary Ternary Operations". IEEE Transactions on Computers. C-24 (2): 212–215. doi:10.1109/T-C.1975.224188. S2CID 38704739.
  8. ^ Parhami, Behrooz; McKeown, Michael (2013-11-03). "Arithmetic with binary-encoded balanced ternary numbers". 2013 Asilomar Conference on Signals, Systems and Computers. Pacific Grove, California, US. pp. 1130–1133. doi:10.1109/ACSSC.2013.6810470. ISBN 978-1-4799-2390-8. S2CID 9603084.{{cite book}}: CS1 maint: location missing publisher (link)
  9. ^ Jones, Douglas W. (June 2016). "Binary Coded Ternary and its Inverse".
  10. ^ Jones, Douglas W. (2015-12-29). "Ternary Data Types for C Programmers".
  11. ^ Impagliazzo, John; Proydakov, Eduard (2006). Perspectives on Soviet and Russian Computing. First IFIP WG 9.7 Conference, SoRuCom 2006. Petrozavodsk, Russia: Springer. ISBN 978-3-64222816-2.
  12. ^ Brousentsov, N. P.; Maslov, S. P.; Ramil Alvarez, J.; Zhogolev, E. A. "Development of ternary computers at Moscow State University". Retrieved 2010-01-20.

Further reading

Read other articles:

Kumiodori, traditional Okinawan musical theatreUNESCO Intangible Cultural HeritageCountryJapanDomainsPerforming artsReference405RegionAsia and the PacificInscription historyInscription2010 (5th session)ListRepresentative Kumi odori (組踊, Okinawan: Kumi wudui) is a form of narrative traditional Ryūkyūan dance. Kumi odori or Kumi wudui means combination dance or ensemble dance. Originating in the Ryūkyūan capital of Shuri, Okinawa in 1719, the original purpose of this dance was to provid...

 

Human settlement in EnglandHibb's GreenHibb's GreenLocation within SuffolkCivil parishLawshallDistrictBaberghShire countySuffolkRegionEastCountryEnglandSovereign stateUnited KingdomPost townBury St EdmundsPostcode districtIP29 List of places UK England Suffolk 52°08′N 0°44′E / 52.14°N 00.73°E / 52.14; 00.73 Hibb's Green is a hamlet in the civil parish of Lawshall in the Babergh district in the county of Suffolk, England. It is located between Ha...

 

Munir El Haddadi El Hadddadi, 2014Informasi pribadiNama lengkap Munir El Haddadi MohamedTanggal lahir 1 September 1995 (umur 28)Tempat lahir El Escorial, SpanyolTinggi 177 cm (5 ft 10 in)Posisi bermain PenyerangInformasi klubKlub saat ini UD Las PalmasNomor 17Karier junior CD Galapagar2010–2011 Atlético Madrid2010–2011 → Rayo Majadahonda (pinjaman)2011–2014 BarcelonaKarier senior*Tahun Tim Tampil (Gol)2014–2015 Barcelona B 38 (8)2014–2019 Barcelona 33 (5)2016...

Michigan–Michigan State men's ice hockey rivalry Michigan Wolverines Michigan State Spartans First meetingJanuary 11, 1922Michigan 5, Michigan State 1[1]Latest meetingMarch 31, 2024Michigan 5, Michigan State 2TrophyThe Iron DStatisticsMeetings total343All-time seriesMichigan leads, 177–142–24[1]Largest victoryMichigan, 17–1 (1950)[1]Longest win streakMichigan, 19 (1928–1954)[1]Longest unbeaten streakMichigan, 33 (1928–1957)[1]Current win st...

 

مرحبا بكم في بوابة عقد 1890   الثورة الفلبينية أول صورة طبية بالأشعة السينية في التاريخ (1895) الحرب الأمريكية الإسبانية ثورة فلاحي دونغهاك الإمبريالية الجديدة الملكة فيكتوريا قضية دريفوس بنز فيلو: إحدى أول السيارات الحرب اليابانية الصينية الأولى عقد 1890 أو تسعينات القرن ال...

 

Prima Divisione 1929-1930 Competizione Prima Divisione Sport Calcio Edizione 2ª Organizzatore Direttorio Divisioni Superiori e Direttorio Meridionale Date dal 6 ottobre 1929al 13 luglio 1930 Luogo  Italia Partecipanti 60 Risultati Vincitore Udinese(1º titolo) Altre promozioni Libertas LuccaDerthonaPalermo Retrocessioni (le squadre scritte in corsivo sono poi state riammesse)AstigianiCorniglianeseCodognoSaronnoAcquaviveseFolignoGrion PolaRovigo Cronologia della competizione 192...

هنودمعلومات عامةنسبة التسمية الهند التعداد الكليالتعداد قرابة 1.21 مليار[1][2]تعداد الهند عام 2011ق. 1.32 مليار[3]تقديرات عام 2017ق. 30.8 مليون[4]مناطق الوجود المميزةبلد الأصل الهند البلد الهند  الهند نيبال 4,000,000[5] الولايات المتحدة 3,982,398[6] الإمار...

 

Star of the Republic of Indonesia Bintang Republik IndonesiaAwarded by the President of IndonesiaTypeOrderEstablished1959Country IndonesiaStatusCurrently awardedGrand MasterPresident of IndonesiaPrecedenceNext (higher)None (highest)Next (lower)Star of MahaputeraRibbon bar of Adipurna classRibbon bar of Adipradana classRibbon bar of Utama classRibbon bar of Pratama classRibbon bar of Nararya class The Star of the Republic of Indonesia (Indonesian: Bintang Republik Indonesia) is Indonesia'...

 

State election in Malaysia 2013 Perak state election ← 2008 5 May 2013 (2013-05-05) 2018 → ← List of Malaysian State Assembly Representatives (2008–2013)#Perakmembers elected →59 seats to the Perak State Legislative Assembly30 seats needed for a majority   Majority party Minority party Third party   Leader Zambry Abdul Kadir Ngeh Koo Ham Muhammad Nur Manuty Party UMNO DAP PKR Alliance Barisan Nasional Pakatan Rakyat Pakata...

Ruko berarsitektur Tionghoa di kawasan Senen, Jakarta. Ruko khas kota Xiamen atau pecinan di Indonesia Ruko (singkatan dari rumah toko) adalah sebutan bagi bangunan-bangunan yang memiliki ciri khas bertingkat antara dua hingga lima lantai. Lantai ruko bagian bawa digunakan sebagai tempat berusaha ataupun semacam kantor sementara lantai atas dimanfaatkan sebagai tempat tinggal. Ruko biasanya berpenampilan sederhana dan sering dibangun bersama ruko-ruko lainnya yang mempunyai desain yang sama a...

 

مشروع مارشال شعار الولايات المتحدة الأمريكيةشعار الولايات المتحدة الأمريكية تاريخ التشريع تعديل مصدري - تعديل   لوحة مشروع مارشال الأمريكية وزير الخارجية الأمريكي جورج مارشال مشروع مارشال هو المشروع الاقتصادي لإعادة تعمير أوروبا بعد انتهاء الحرب العالمية الثانية ال�...

 

French mathematician Patrice Ossona de MendezPatrice Ossona de MendezBorn (1966-12-13) 13 December 1966 (age 57)Paris, FranceNationalityFrenchAlma materEHESS, ParisScientific careerFieldsMathematicianInstitutionsCentre national de la recherche scientifiqueDoctoral advisorHubert de Fraysseix, Pierre Rosenstiehl Patrice Ossona de Mendez is a French mathematician specializing in topological graph theory who works as a researcher at the Centre national de la recherche scientifique in Pa...

Military commander Pablo Alí Pablo Alí was a chief military commander of Haitian origin, who was in charge of the so-called Battalion 31 or Batallon de Morenos (Dark-skinned Battalion),[1] freed slaves which joined the ranks of the Dominican army. Alí directed the battalion to participate in the Italian rebellion of 1810, during the government of Sánchez Ramírez.[2] He was said to have been most prominent, achieving great military distinction in Santo Domingo.[3] ...

 

العلاقات اليمنية الهايتية اليمن هايتي   اليمن   هايتي تعديل مصدري - تعديل   العلاقات اليمنية الهايتية هي العلاقات الثنائية التي تجمع بين اليمن وهايتي.[1][2][3][4][5] مقارنة بين البلدين هذه مقارنة عامة ومرجعية للدولتين: وجه المقارنة اليمن هايتي �...

 

نواه أوكافور (بالألمانية: Noah Okafor) أوكافور مع ريد بول سالزبورغ عام 2022 معلومات شخصية الاسم الكامل نواه أرينزيتشوكو أوكافور[1] الميلاد 24 مايو 2000 (العمر 24 سنة)[1]بازل، سويسرا الطول 1.85 م (6 قدم 1 بوصة)[1] مركز اللعب مهاجم الجنسية سويسرا  معلومات النادي النادي ا�...

莫應帆Mok Ying-fan議員香港立法局議員任期1995年10月11日—1997年6月30日 前任杜葉錫恩选区市政局 市政局議員任期1989年4月1日—1999年12月31日 选区黃大仙南(1989年-1995年)橫頭磡、東頭、樂富及天馬(1995年-1999年) 黃大仙區議會議員任期1994年10月1日—2015年12月31日 继任施德來选区東美 任期1985年10月1日—1991年9月30日 前任鍾熙然继任馮光中选区東頭 个人资料出生 (1951-01-15) 19...

 

Darkest color due to absence or absorption of light This article is about the color. For the race, see black people. For other uses, see Black (disambiguation). Black Clockwise, from top left: Anubis statue; American black bear; Galaxy NGC 406; The Supreme Court of the United States in October 2022; Portrait painting of Queen Victoria.     Color coordinatesHex triplet#000000sRGBB (r, g, b)(0, 0, 0)HSV (h, s, v)(0°, 0%, 0%)CIELChuv (L, C, h)(0, 0, 0°)SourceHTML/CSS[1&#...

 

サモスSamoth エンペラーのライヴでのサモス(2017年、ヴァッケン・オープン・エア)基本情報出生名 Tomas Thormodsæter Haugen別名 ザモス ZamothSamot生誕 (1974-06-09) 1974年6月9日(50歳) ノルウェーフィンマルク県 ハンメルフェスト出身地  ノルウェー トロムス県 トロムソジャンル ブラックメタルシンフォニックブラックメタルデスメタルデスラッシュ職業 ギタリスト作�...

Pseudo-Dionysian work on angelology, 5th ct. Part of a series onNeoplatonismReconstructed bust believed to represent Plotinus Concepts Theory of forms Form of the Good Hypostasis Arche Nous Demiurge Logos Anima mundi Henosis Theurgy Okhema Microcosm and macrocosm Works Enneads De Mysteriis Aegyptiorum Liber de Causis The City of God The Consolation of Philosophy De Coelesti Hierarchia De divisione naturae Chaldean Oracles People Plotinus (students) Porphyry Iamblichus Julian the Apostate...

 

BoussycomuneBoussy – VedutaBoussy visto da Rumilly LocalizzazioneStato Francia RegioneAlvernia-Rodano-Alpi Dipartimento Alta Savoia ArrondissementAnnecy CantoneRumilly TerritorioCoordinate45°51′N 5°59′E45°51′N, 5°59′E (Boussy) Altitudine326 e 567 m s.l.m. Superficie5,22 km² Abitanti480[1] (2009) Densità91,95 ab./km² Altre informazioniCod. postale74150 Fuso orarioUTC+1 Codice INSEE74046 CartografiaBoussy Modifica dati su Wikidata · Manua...