Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 9, NO. 10 / OCTOBER 1983 / PAGE 210

Modular arithmetic and computer art. Matthew Walling; David Meger.

For thousands of years people have been using mathematical shapes based on precise mathematical formulae to generate artistic designs for everything from architecture to potter. So it is not surprising that we should find art in number patterns--an art which is created by the direct substitution of colors for numbers. The number patterns that we have chosen to investigate are produced using modular arithmetic.

Although the term modular (or remainder) arithmetic may not be immediately familiar, we use it every day to tell time. The clock is a "mod twelve number system." For example, three hours past ten o'clock is not thirteen o'clock but one o'clock. One is the remainder when thirteen is divided by twelve. In the clock example, zero is the remainder when twelve in the clock should more properly be replaced by zero. Any mod number system, regardless of the dividend, should contain only numbers from 0 to mod-1, and therefore will have repetitive patterns of numbers.

The study of modular (or remainder) arithmetic dates back to the first century A.D. and the Chinese mathematician Sun-Tsu. Recently teachers have been introducing modular arithmetic to junior high students as art in an attempt to generate more enthusiasm for mathematics. The technique involves the use of graph paper, and felt tip pens, crayons, colored pencils, or construction paper.

The students use remainder arithmetic to make a number table of remainders on the graph paper. Number tables are formed by first labelling rows and columns on the graph paper, then filling in the rest of the blocks with the numbers which are the remainders when the row is either added or multiplied by the column and divided by the chosen mod. The remainders are then replaced by colors. Using this technique, one design can take more than an hour to complete. With a personal computer, however, designs can be churned out in rapid succession.

The Tables 1 through 4 are typical modular number systems for both addition and multiplication. Figure 1, an example of an addition number system shows a striped pattern. This pattern i observed for all mods using addition. Subtraction is the same, but the stripes go in the opposite direction.

For multiplication number systems for even mods (Table 2 and Figure 2) the remainders alternate between even and odd numbers between rows of even numbers. The multiplication number systems using odd mods (Tables 3 and 4 and Figures 3 and 4) have a more complex pattern. All of these systems can be used to generate most unusual patterns. About the Process

The process of generating remainder number tables is very simple for the computer. With an input statement, the mod is chosen. Then an array of colors versus remainders is formed with another input statement. Two FOR-NEXT loops count rows and columns up to the size of the computer screen. The rows and columns are either added or multiplied. Next the remainder is calculated, the color is set and the point plotted.

The program for the Apple II is shown in Listing 1. It has a short tutorial on modular arithmetic, displays a number system on the screen, displays the Apple color table, and plots the pattern on the lo-res screen.

Listing 2 is written for TRS-80 Color Computer, and Listing 3 is for the TI 99/4. Listings 2 and 3 contain the minimum code necessary for generating the patterns.

The TI 99/4 program has the additional ability to plot shapes other than the block to which the other two computers are limited. It can plot any power in forcing the problem to solution. At some point, called 'incubation' by many who have reported the process, he treats the problem 'as if it has a life of its own,' which will, in its time and in its relation to his subliminal or autonomous thought processes, come to the solution. He will consciously work on the problem, but there comes a point when he will 'sleep on it.'"

During the incubation period, the autonomous thought processes in the unconscious take over and continue to solve the problem. Often, when the conscious forcing of the problem to solution has failed, the incubational process succeeds. Productive Periods

The creative person develops an awareness in retrospect of the periods when he solved his problems creatively. He takes note of the methods that were successful and those that failed. He tries to learn why by retracing, as far as he can, the routes he followed and noting those he avoided. He has learned that knowledge of his particular idiosyncrasies and style of creating facilitates his creative process.

He schedules his creative thinking periods for those times when he has his most favorable mental set for producing ideas. H is aware of his personal rhythms and peaks and valleys of output. By keeping a record of those periods during the day or night in which he is most creative, he can establish a pattern and plan ahead, reserving peak periods for concentration and uninhibited thinking, and his less productive time for reading and for gathering information. Even if he has not established a timesheet of productive periods, he has at least developed a sensitivity to those moods that promise really creative returns from his efforts, and he knows when they are approaching. Other Characteristics

Here are some of the other characteristics that differentiate the more creative individual from the less creative:

* He is more observant and perceptive, and he puts a high value on independent "true-to-himself" perception. He perceives things the way other people do but also the way others do not.

* He is more independent in his judgments, and his self-directed behavior is determined by his own set of values and ethical standards.

* He balks at group standards, pressures to conform the external controls. He asserts his independence without being hostile or aggressive, and he speaks his mind without being domineering. If need be, he is flexible enough to simulate the prevailing norms of cultural and organizational behavior.

* He dislikes policing himself and others; he does not like to be bossed around. He can readily entertain impulses and ideas that are commonly considered taboo; he has a spirit of adventure.

* He is highly individualistic and non-conventional in a constructive manner. Psychologist Donald W. MacKinnon puts it this way: "Although independent in thought and action, the creative person does not make a show of his independence; he does not do the off-beat thing narcissistically, that is, to call attention to himself. ...He is not a deliberate nonconformist but a genuinely independent and autonomous person."

* He has wide interests and multiple potentials--sufficient to succeed in several careers.

* He is constitutionally more energetic and vigorous and, when creatively engaged, can marshal an exceptional fund of psychic and physical energy.

* He is less anxious and posseses greater stability.

* His complex personality is, simultaneously, more primitive and more cultured, more destructive and more constructive, crazier and saner. He has a greater appreciation and acceptance of the nonrational elements in himself and others.

* He is willing to entertain and express personal impulses, and pays more attention to his "inner voices." He likes to see himself as being different from others, and he has greater self-acceptance.

* He has strong aesthetic drive and sensitivity, and a greater interest in the artistic and aesthetic fields. He prefers to order the forms of his own experience aesthetically, and the solutions at which he arrives must not only be creative, but elegant.

Truth for him has to be clothed in beauty to make it attractive.

* He searches for philosophical meanings nd theoretical constructs and tends to prefer working with ideas, in contra-distinction to the less creative who prefer to deal with the practical and concrete.

* He has a greater need for variety and is almost insatiable for intellectual ordering and comprehension.

* He places great value on humor of the philosophical sort and possesses a unique sense of humor.

* He regards authority as arbitrary, contingent on continued and demonstrable superiority. When evaluating communications, he separates source from content, judges and reaches conclusions based on the information itself, rather than whether the information source was an "authority" or an "expert."