# Ternary Computers: The Setun and the Setun 70

Nikolay Petrovich Brusentsov, José Ramil Alvarez

► To cite this version:

Nikolay Petrovich Brusentsov, José Ramil Alvarez. Ternary Computers: The Setun and the Setun 70. 1st Soviet and Russian Computing (SoRuCom), Jul 2006, Petrozavodsk, Russia. pp.74-80, 10.1007/978-3-642-22816-2_10 . hal-01568401

HAL Id: hal-01568401

https://inria.hal.science/hal-01568401

Submitted on 25 Jul 2017

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Ternary Computers: The Setun and the Setun 70

Nikolay Petrovich Brusentsov¹ and José Ramil Alvarez²

1. Moscow State University, ramil@cs.msu.su

2. Moscow State University, ramil@cs.msu.su

**Abstract.** This paper presents a short history of the development ternary computers "Setun" and "Setun 70" at Moscow State University. It explains the characteristics of their architectures and programming systems (Interpretive Programs), the production and practical usage of Setun-computers, the structured programming on two-stack "Setun 70", the dialogue system of structured programming – DSSP, and the computer assisted teaching system "Nastavnik".

**Keywords:** Ternary computer, trit, tryte, Setun, DSSP, Nastavnik

## 1 Introduction

At the beginning of 1956, the department of electronics came into being at the computer center of Moscow State University (MSU) through the initiative of S.L. Sobolev, a member of the Russian Academy of Science. At the time, Sobolev was the head of the department of calculating mathematics at the mechanical and mathematical faculty of MSU. He initiated a seminar with the aim of providing practical examples for a digital machine usable in universities, in laboratories, and in the design burros of industrial enterprises. It was necessary to create a small computer that was simple to use and master, that was reliable and inexpensive but at the same time was effective in solving a wide range of problems.

A detailed study had begun to determine the status of current computers and their technical abilities. This effort lased a year. The study led to a nonstandard decision to use in the created machine not the binary code but the ternary code. Twenty years later, Donald E. Knuth called this the "balanced" system of calculating and which "may be the most graceful" [10]. Claude E. Shannon revealed some of the advantages of this system in 1950 [12].

The common binary code used in modern computers has the digit set {0, 1}.
Binary code does not contain arithmetical full value, as it is impossible to represent
the negative numbers in it. However, a ternary code with a digit set {-1, 0, 1}
provides optimal arithmetical values for numbers formation. Therefore, we not only
an artificial and imperfect complement code of numbers, but we also obtain
considerable arithmetical advantages. These include a uniform number code, a
variable length of operands, a singular shift operation, a tri-value of a function's "sign
of a number", an optimal rounding by simply cutting off lower digits, and a
compensation of errors rounding in the process of calculating [7].
## 2 The Setun Computer

To address this new challenge, we had to create a new computer—a ternary computer—called the “Setun” as an experimental model [1, 2]. By the end of 1958, we assembled and began to use the new machine with the collaborators of the electronics department. As we mastered the machine and gained more experience with the program facilities and the variable practical devices, it was obvious that the Setun computer met all requirements and all foreseen tasks intended by its creation.

This success showed the efficacy of the ternary digital machine, even taking into account that the creation of such equipment was the first of such machines completed by a small group of the beginners (eight graduate pupils from MEI and MSU, and twelve technicians and laboratory assistants) in short period of time. In comparison with the binary elements of memory and elementary operations, the ternary design made the architecture of computer more natural and simple.

### 2.1 Features of the Setun

With a minimum set of commands (only 24 single-address commands), the “Setun” provided an opportunity to do calculations with fixed-point and floating-point numbers. The machine had an index register, the value of which could modify an address by addition or subtraction. It also provided the addition operation with products that optimized polynomial calculations. It utilized three-valued (trit) operations for multiplying and three commands for conditional transition according to the sign of the result. The simple and effective architecture provided an opportunity to facilitate the computer with the programming system and a set of application programs [13] by a small group of programmers by the end of 1959. That was sufficient for interdepartmental testing of the experimental model by April of 1960.

According to the results of testing, the “Setun” computer became “the first working sample of a universal computer on the base of elements without lamps”. The machine had the following characteristics: “high productivity, sufficient reliability, small forms, simple technical service”. The Council of Ministers of the USSR made a resolution of the serial production of the “Setun” at the Kazan plant of mathematical computers by the recommendation of an interdepartmental committee of experts.

### 2.2 Production Dynamics

However, for reasons unknown, the officials from Radio Electronically Department did not like the ternary computer and they did not provide the serial production of the computer sample. When it received the opportunity to use the M-20 computer produced in the plant, it did not help the output progress. Notwithstanding, when the number of orders (particularly from abroad) for the Setun grew, they limited the output, which resulted in declining orders and by 1965, they stopped production. In addition, they prevented the mastering of the machine in the USSR where they planned a large production of the machine. The reason for such strange “politics” could have been the very low price of “Setun”. It sold for only 27,500 rubles because of the perfect production of its magnetic digital elements at the Astrakhan plants EA
and EP where it cost only 3 rubles and 50 kopeks for each element. (The machine had about 2 thousand elements.)

It was essential that electromagnetic elements of the “Setun” accomplished the threshold realization of ternary logic that was truly economical, natural, and reliable. They destructed an experimental model that was in an absolute working state after seventeen years of continuous operation in the computer center of MSU. We changed only three elements with defects during the first year of operation and the machine did not need any repairs to the inner devices. The serial machines functioned well in different climatic zones from Odessa and Ashkhabad to Yakutsk and Krasnoyarsk without any service or spare parts.

Thanks to its simplicity, its natural architecture, and its rational constructed programming system, the Setun effectively used an interpretive system successfully. Some of its features included floating-point numbers with eight decimal digits (IP-2), floating-point numbers with six decimal digits (IP-3), complex numbers with eight decimal digits (IP-4), floating-point numbers with twelve decimal digits (IP-5), auto code “Poliz” with its operating system, and a library of standard programs that used floating-point numbers with six decimal digits.

Users at universities, industry enterprises, and the Scientific Researching Institute (SRI) well mastered the Setun computer. It became an effective tool for solving practical important problems in very different fields from scientific researching modeling and design calculating to weather forecasting and the optimization of enterprise management [3]. Users conducted many seminars on the Setun computer at MSU (1965), at the Ludinovskij locomotive building plant (1968), and at the Irkutsk Polytechnic Institute (1969). Dozens of reports emerged about the economic application of these computers. Thanks to its natural ternary symmetric code, the Setun appeared to be a real universal calculating device. It positively proved to be a technical research tool for computer mathematics in more than thirty universities. For the first time an automated system of computer-assisted instruction occurred at military air engineering academies base on the Setun [11].

## 3 Some Mathematical Details

The ternary system of calculating applies the same principle of number coding as applied in the binary system used in modern computers. However, the weight of the i-th position is not 2^i, but 3^i. The positions themselves are not two-valued (bits), but three-valued (trits); that is, in addition to 0 and 1, there is a third value, which is -1, thanks to the uniformly represented by positive and negative numbers. We can calculate the value of an n-trit number similar to calculating the value of an n-bit number. That is,

$$N = \sum_{i=0}^{n-1} \alpha_i 3^i = \alpha_{n-1} 3^{n-1} + \alpha_{n-2} 3^{n-2} + \alpha_i 3^i + \dots + \alpha_1 3 + \alpha_0$$

where $\alpha_i \in \{-1, 0, 1\}$ is a place value in the i-th position.

The symmetrical system of ternary numbers lends itself to use signs for place value coefficients; that is, instead of using 1, 0, -1, we can use +, 0, -. For example,
the decimal numbers 13, 7, 6, -6 in such a ternary record would have a representation by:

o + + + for +13,

o + - + for +7,

o + - 0 for +6, and

o - + 0 for -6.

The sign change of a number using the symmetrical code is equal to a ternary inversion; that is, interchange all “+” values into “-” values and all “-” values into “+” values. Using the above, the representation for -7 would be simply - + -. The definition of addition and multiplying in the ternary symmetrical code appear in the tables below.

<table><thead><tr><th>Add</th><th>+</th><th>0</th><th>-</th></tr></thead><tbody><tr><th>+</th><td>+ -</td><td>+</td><td>0</td></tr><tr><th>0</th><td>+</td><td>0</td><td>-</td></tr><tr><th>-</th><td>0</td><td>-</td><td>- +</td></tr></tbody></table>

<table><thead><tr><th>Multiply</th><th>+</th><th>0</th><th>-</th></tr></thead><tbody><tr><th>+</th><td>+</td><td>0</td><td>-</td></tr><tr><th>0</th><td>0</td><td>0</td><td>0</td></tr><tr><th>-</th><td>-</td><td>0</td><td>+</td></tr></tbody></table>

Unlike the binary code, this arithmetic of signed numbers and the sign of a number is the value of its higher position (not 0 or 1). Problems arising from signed numbers do not have a “perfect solution” in binary code. In the ternary symmetrical code, no such problem exists, which is its advantage.

We can characterize the Setun computer as having a single sequential address, with a 9-trit command code, an 18-trit register summarizer S and multiplier R, a 5-trit index register for address modification F, a pointer for fulfilling commands C, and a one-trit pointer of a result sign $\omega$ that can regulate conventional transitions.

The operating memory contained 162, 9-trit cells divided into 3 pages with 54 cells per page for exchange with memory, and a magnetic drum having a size of 36 or 72 pages. Reading and recording into the operating memory occurs using either 18-trit or 9-trit words; a 9-trit word corresponds to the older half of an 18-trit word appearing in the registers S and R. We interpret the content of these registers as fixed number after the second from older position's point; that is, according to module it is less than 4, 5. When calculating with a floating-point mantissa M of a normalized number, it must satisfy the condition that $0.5 < |M| < 1.5$; the order appears as a separate 5-trit word interpreted as whole number with a sign. Page two-stage structure of a memory with word address in the range of three pages that has a 5-trit addresses and a 9-trit commands gave a unusual compact programs and at the same time high speed of the computer in spite of the fact that in interpreting systems magnet drum functions as an operating memory.
## 4 The Setun 70 Computer

Between 1967 and 1969, we created a ternary digital Setun 70 computer based on the experience and practical application of the Setun computer. An experimental model appeared in April of 1970. This computer contained a nontraditional two-stack architecture designed on the premise of providing good conditions for further expansion and development of its abilities by using an interpretive system method [4].

The Setun 70 used an arithmetic stack (a stack of 18-trit operands) because of the Polish inversion writing program ("Poliz") used as a computer language; Poliz worked well on the Setun computer. The Poliz-program did not consist of commands of different addresses; instead, it used short word logic of 6-trit trytes. As an element of a program, we defined a tryte (the smallest addressable unit) for addressing or for operating. We used an addressing tryte as an operand or as an instruction to send an addressing word (one to three trytes) from the operating memory onto the operand stack. There were only nine pages with 81 trytes per page in the operating memory; for the access, we opened only three pages with their numbers in the "pointing registers". The operating tryte points the operations or procedures for the operands stack and the processor register. There are only 81 operations: 27 basic types, 27 auxiliary types, and 27 that are programmable by a user.

The second system stack had return addresses when processing breaks. The fulfillment of the program allowed the realization of E.W. Dijksta's idea of structured programming on the Setun 70. This allowed for an input call operation of a program, a call according to a condition, and a fulfillment of a program cycle. As a result, the machine confirmed that procedural structured programming highlighted the advantages of Dijksta's method; that is, the difficulty of creating programs became five to seven times less, thanks to the traditional testing "arrangement" on examples we used. Moreover, the programs became more reliable, logical, understandable, and easily modifiable. In addition, the peculiarities of the Setun 70 became a basis for dialogue system of the structured programming DSSP that was accomplished on the DVK type computers and on personal computers [6, 8].

## 5 The Setun 70 and the "Nastavnik"

Unfortunately, administrative decisions stopped the further development of the abilities of the Setun 70 computer and its programming capabilities. We had to change our focus toward the study of computerization. The Setun 70 became the basis for development and fulfillment of automated computer systems for the teaching of "Nastavnik" [5, 9] that contained the principles of Y.A. Kamenskij's "Great Didactics". The purpose of the computer in this system was not the "electron turning over pages" and multimedia effects; instead, it checked the students' understanding of what they were studying in an attempt to overcome misunderstandings and providing with real subject skills by exercises. In addition, the computer would record the lesson itself giving the creator the opportunity to evaluate the effectiveness of using didactics methods and to modify the material and improve them.
Studying materials in “Nastavnik” appeared in typed form with numbered sections, passages, exercises, and notice of wrong answers. Thanks to the Setun 70, the computer was able to interact with a student rather easily. It gave the “book” the ability of communicating with a reader with the help of simple terminal with digital keyboard, and calculating indicator. The creation of study materials for the “Nastavnik” was not associated with computer programming; in practice, it showed that schoolteachers could create materials in mathematics, physics, English, and other subjects. The didactic effectiveness of the system was very high. For example, for the course in “Basic Fortran”, students of MSU studied on the “Nastavnik” for ten to fifteen hours, students from the economics department for fifteen to twenty hours. The results showed that students using the computer had better programming skills in Fortran than those studying a usual semester course on the subject.

The principle of using a “book-computer” in the “Nastavnik” provided an opportunity for optimal computer usage as a practical means for studying. In all respects, the Setun computer provided the necessary tool (microcomputers and connected with it, 30-40 terminals as a simple calculator) for automated learning; it was inexpensive, reliable, and easily mastered by students and teachers. The work in a regime of a dialogue was not difficult; in fact, it was fascinating and guaranteed quick and good mastering of a subject that had good material organization. The application system at MSU, MAI, VIA, in schools, and for professional studying at a plant proved its effectiveness in wide range of subjects and study levels. The “Nastavnik” functioned for thirty years for automatic testing and tests to identify the English language level of first year students to form groups according to levels.

Despite the great necessity to improve the process of studying in the “informative” twentieth century, the “Nastavnik” began to fall in disfavor. The reasons may include its low price, its simplicity, and the lack of a proper display, mouse, and hypertext. The fact remains that using information technologies in the process of studying elevates student learning according to the number of computers used and their power and not to their level and quality of teaching.

## References

[1] Brusentsov, N.P.; “Computer ‘Setun’ of MSU”, *New Developments in the Field of Calculating Mathematics and Computers*, Kiev, 1960, pp. 226-234.

[2] Brusentsov, N.P., S.P. Maslov, V.P. Rozin, and A.M. Tishulina; “A small computer ‘Setun’”, MSU, 1965, p. 145.

[3] Brusentsov, N.P., V.A. Morozov; “Annotated guide of programs for ‘Setun’”, MSU, 1968, #2, 1971.

[4] Brusentsov N.P., E.A. Zhogolev; “Structure and algorithms of small computer functioning”, *Computers and Problems of Cybernetics*, #8, L. 1971, pp. 34-51.

[5] Brusentsov, N.P., S.P. Maslov, J. Ramil Alvarez; “Automated system teaching ‘Nastavnik’”, *Computers and Problems of Cybernetics*, #13, MSU, 1977, pp. 3-17.

[6] Brusentsov, N.P., G.V. Zlatkus, I.A. Rudnev; “Dialogue system of structured programming”, *Programming Rigging of Microcomputers*, MSU, 1982, pp. 11-40.
[7] Brusentsov, N.P.; "Notes about ternary digital equipment", *Architecture and Programming of Digital Systems*, MSU, 1984, pp. 114-123.

[8] Brusentsov, N.P., V.B. Zakharov, I.A. Rudnev, S.A. Sidorov, N.A. Chanshev; "Developing adapting language of a dialogue system of programming", MSU, 1987, p. 80.

[9] Brusentsov, N.P., S.P. Maslov, J. Ramil Alvarez; "Microcomputer system teaching 'Nastavnik'", *Nauka*, 1990, p. 223.

[10] Knuth D.E.; "Seminumerical algorithms", *The Art of Computer Programming*, Vol. 2, Addison-Wesley, 1969.

[11] Kuznezov S.I.; Materials on mathematical service of "Setun", 1964.

[12] Shannon C.E.; "Symmetrical notation for numbers", *The American Mathematical Monthly*, v. 57, n.2, Feb. 1950, pp. 90-93.

[13] Zhogolev E.A.; ""The Order Code and An Interpretative System for the SETUN Computer"", *USSR Comp. Math. and Math. Physics*, 1962, #3, Pergamon Press, pp. 563-578.