Fun with Integer Sequences
Year: 2017 Authors: Kerry Mitchell
Core claim
Integer sequences can generate visually rich art through symbol-based and curve-based rendering methods that encode sequence structure and repetition.
Topics
integer sequences, algorithmic art, digit visualization, curve rendering
Domains
number sequences, irrational numbers, Gaussian integers, prime numbers, generative art, op-art, symbolic design, data art
Methods
symbol encoding, tile-based composition, spline curves, quarter-circle walks
Media
digital images, colored symbols, tiles, curves
Paper text
The text below is the locally extracted OCR/Markdown version of the paper. Raw PDF files remain local and are not published here.
Bridges 2017 Conference Proceedings
Fun with Integer Sequences
Kerry Mitchell, Artist 3833 N. 30th Street, #247, Phoenix, AZ 85016, USA lkmitch@gmail.com
Abstract
I present several ways to create images from sequences of integers. Methods are explored that employ discrete symbols and continuous curves. Various types of integer sequences are presented as examples, including digits of irrational numbers, real-valued and Gaussian integers, and sequences arising from numeral substitution rules.
Introduction
In the field of two-dimensional visual art, “algorithmic” art often brings to mind generative art or fractal art, both of which rely heavily upon iterations of real numbers. The present work discusses several ways to create art using instead, sequences of integers. By their nature, integers are discrete, a characteristic that can greatly impact the choice of rendering method. While several examples of integer sequences are given, a comprehensive source is the Online Encyclopedia of Integer Sequences [1].
Symbols
Artists can use symbols, which are discrete, in a variety of ways to represent elements of a sequence. Perhaps the simplest is to have each symbol stand for a member of set, the count of which is the number. Figure 1 shows this method for the sequence of triangle numbers (1, 3, 6, 10, …).
Figure 1: Illustrating the triangle numbers 1, 3, 6, and 10.
Gilbert [2] explored the notion of expressing Gaussian integers (complex numbers with integer real and imaginary parts) in complex bases, e.g., in a base of . It turns out that doing so reveals approximate fractal structure in the values that can be expressed with a given number of digits. Since Gaussian integers form a lattice in the complex plane, dots of finite size are effective in filling the image with color while only showing a relatively few numbers. By adding color, each dot can also show how many digits are required to express a particular number. In Figure 2, the locations of the dots reflect the integer expressed, and the shading indicates how many digits are required to represent the number using the numerals and the base . Two open dots indicate the two single-digit numbers, and , and the shading darkens as the number of digits increases. The solid black dots show 14 of the 16
Mitchell
numbers that require five digits. The two numbers in decimal) and in decimal) are drawn as a square and a triangle, respectively, for clarity.
Figure 2: The 32 five-digit complex numbers in base .
By varying the shapes of the symbols, additional information can be encoded. For example, in Figure 3, 10 symbols are used to represent the numerals 0-9. The top row contains 0-4 (left to right) and the bottom row shows 5-9 (left to right). These are employed in to show the digits in the first six powers of 5. Each column is read from the top down, with the digit in the ones place along the bottom row. The leftmost column has a single symbol for 5. Moving to the right, the columns show 25, 125, 625, 3,125, and 15,625 (in the rightmost column). Patterns in the digits are made clear, such as the last digit always being 5, the last two digits being 25, and the last three oscillating between 125 and 625. The author’s image “Decimal Powers of 5” [3] shows this for powers up to .
Figure 3: Symbols for 0-9 (above) used to illustrate the first six powers of 5 (right).
“Numerator 3” [3] uses this technique to explore “long primes” in base 3. A long prime is a prime number such that fractions with a denominator of have decimal expansions containing repeating blocks of digits. For example, in base 10, 7 is a long prime. The fraction has the decimal expansion , where the block “142857” is six digits long and repeats infinitely. Likewise, , where the block “571428” is also six digits long and is repeated
Fun with Integer Sequences
infinitely. In base 3, 5 is a long prime; 1/5 in base 3 is 0.01210121…, where the four-digit block “0121” repeats. In “Numerator 3,” the decimal expansions of seven fractions are shown simultaneously: 3/233, 3/257, 3/269, 3/281, 3/283, 3/293, and 3/317. In each case, the denominator is a long prime in base 3 and the digits of the base three expansions are shown. Each star-shaped cell is a composite of seven astroid shapes, one for each fraction. The orientation of the astroid reveals the value of the digit and each fraction is distinguished by the size of its astroid. The denominators were chosen such that the digits would not repeat over the extent of the image. Figure 4 shows the image and a magnification, showing the detail.
Figure 4: “Numerator 3” and magnification of its center.
By using symbols whose shapes tile the plane, the artist can move even further away from pure technical illustration into art. Figure 5(a) presents a series of 10 square tiles, representing the numerals 0 (left) through 9 (right). In Figure 5(b), these tiles combine to show the first nine digits of pi (3.14159265, moving from left to right, top to bottom); solid gray bars separate the tiles for clarity. In Figure 5(c), the first 25 digits are shown. Without the bars, the distinct tiles are diminished, leaving the viewer to consider the image’s overall nature. Even though is an irrational number, its digits are an infinite sequence whose distribution is indistinguishable from being random.
Of course, squares are not the only shape that tiles the plane. Using thin vertical rectangles, images reminiscent of Bridget Riley’s op-art [4] can be created. The author’s images “Serotinal” [3] and “Verdant” [3] are two examples. Each uses stripes of 10 different, but coherent, colors to represent elements of numeral substitution sequences. In both cases, the sequence begins with a single integer and a substitution rule is repeated—at each step, substitute each numeral in the string with the sum of it plus a constant number. In “Verdant,” the sequence began with 1 and 18 was added to each digit. The sequence continues: 1, 19, 1927, 19272025, 1927202520182023, etc. The image is drawn from a later step in the sequence with 3,000 digits. A smaller version of this type of image is shown in the top of Figure 6. The bottom shows the effect of using a different substitution rule—each numeral is replaced with its square, beginning with 5. Each strip represents a numeral from 0 (black) to 9 (white).
Mitchell
a) Tiles representing numerals
b) First nine digits of
c) First 25 digits of
Figure 5: Using tiles to illustrate digits of
Figure 6: Numeral substitution sequences illustrated with vertical strips.
Curves
Even though the integers are discrete, rather than continuous, there are ways to create images of their sequences using curves. One method is with a spline, which is a curve that is designed to pass through each point in a given set of points. The key, then, is to align the given points with the integer sequence. In Figure 7, the black dots represent the numbers and the sequence of interest is the first four primes: 2, 3, 5, and 7. Two splines are shown (thin black and thick gray curves), each beginning at 2, passing through 3 and 5, and ending at 7. Both curves are Lagrange polynomial splines [5], which are completely determined by the given points through which the curves are required to pass. Because a Lagrange polynomial is required to pass through all of the given points, the curve can take wild twists and turns. Figure 8 shows how this characteristic can be exploited for aesthetic interest. By defining additional given points, which are not shown in the image, the splines can take on radically different shapes.
Fun with Integer Sequences
Figure 7: Two Lagrange splines interpolating the points 2, 3, 5, and 7.
This technique can be expanded by using a characteristic of fractions: if the denominator of the fraction (in lowest terms) has prime divisors not shared by the base of the number system, then the decimal expansion of the fraction will eventually repeat. For example, , repeating 02439 forever, because 41 has no prime factors in common with the base, 10. So, as an integer sequence, the digits of form a repeating pattern. This can be reflected in the spline by having the ends of the curve come together, forming a loop. Figure 8 shows this for . Figure 8(a) (left) has the digits 0-9 arranged in a line (0 on the left to 9 on the right) and Figure 8(b) (right) has them in a circle (0 at the 3 o’clock position, then increasing counter-clockwise). In either case, begin at the 1 dot and move to the 4 dot. Continue along the curve in that direction and you’ll encounter 2, 8, 5, and 7, in order, and then back to 1 to begin repeating the pattern. And since 7 is a cyclic number (in base 10), all of the fractions with denominators of 7 have decimal expansions that repeat the same block. For example, begin at the 8 and move to the 5 and the sequence for the digits of the decimals of (0.857142…) will be traced out.
Figure 8: Spline examples representing the repeating digits of (0.142857…) along a line (left) and around a circle (right).
Mitchell
Figure 9: “Day 130,” representing the digits of 130/365 (0.35616438…).
Figure 9 [3], “Day 130” shows this technique applied to the fraction ( ). This fraction corresponds to May 10 (the author’s birthday) being the day of a 365-day year. Multiple paths are shown, all passing through the same given points, for aesthetic interest.
The methods discussed thus far have used one sequence at a time, but there are many ways to combine two sequences into the same image. If the elements of one sequence are used as the -coordinates and the elements of the second sequence as the -coordinates, then a curve can be drawn connecting the points in the plane. Generally, this will not be an interesting plot, unless the two sequences are related. Two sequences that are ideally suited for this are the signature sequence [6] of and that of , where is a positive irrational numbers. If is irrational, then it cannot be represented exactly as a fraction, (for integers and ). If is an irrational number, then is irrational, and if and only if and . Thus, for any integers and , the values can be sorted from low to high, and the values in the sorted list are the signature sequence for . The values form the signature sequence for . When plotted together, the sequences create a continuous series of line segments that do not appear to cross (for any irrational value of ). Figure 10 shows an example for , the Golden Mean, approximately 1.618034. The three images show the sequences generated for and varying 1-10 (left), 1-20 (center), and 1-40 (right).
Figure 10: The signature sequences of and drawn as continuous lines on a grid (left), a grid (center), and a (right).
Fun with Integer Sequences
Finally, let’s look at “random” walks. With an actual random walk, segments (straight or curved) are drawn, with the length and/or direction of the segments being given by random numbers. Here, I use the terms of sequence(s) to determine the length and direction, so these are not true random walks, but may appear to be in some cases. There are many ways to do this; some of which I described in a previous essay [7]. In my “Fibonacci Word” series of images [3], I employed this method with the Fibonacci word sequence. This sequence is built in a way similar to the normal Fibonacci sequence—each subsequent term is the sum of the previous two. However, the Fibonacci word is a string of two characters, such as A and B or 1 and 2. Using 1 and 2, the word is built in iterations, beginning with 1 and 12. From there, the previous two terms are concatenated (immediately previous + second previous) to produce the new term. After 1 and 12, the next terms are: 121, 12112, 12112121, etc. Image “Fibonacci Word 1” (see Figure 11) was produced using the 16th step of the sequence, the elements determining how much to turn between straight-line segments.
Figure 11: “Fibonacci Word 1”.
Other curves can be used instead of straight lines. One alternative is quarter-circle arcs (any angular width arc can be used, but quarter-circle arcs are easy to work with). In Figure 12, the first digits of are used to create the circular-arc walks. In all four cases, the radius of the arc is given by the digit (i.e., the first two digits are 3 and 1, so the first two arcs have radii of 3 and 1 units, respectively). However, the turn direction between arcs needs to be determined. At the end of the current curve, there are two choices for adding a new arc—clockwise or counter-clockwise movement around the new arc. In Figures 12(a) and (b), all the arcs were set with the direction being counter-clockwise. In Figures 12(c) and (d), the odd/even parity of the digit determined if the direction was clockwise or counter-clockwise. Each curve begins at the open dot and ends at the open square.
a) 10 digits, all turns counter-clockwise
b) 100 digits, all turns counter-clockwise
c) 10 digits, direction determined by odd/even
d) 100 digits, direction determined by odd/even
Figure 12: Quasi-random walks using digits of and quarter-circle arcs.
Mitchell
Two final examples are shown in Figure 13. Since no prime number is a perfect square, the square roots of prime numbers are irrational numbers, and each root is an irrational number, whose digits form an infinite sequence of positive integers. In Figure 13(a), the radii of the arcs are given by the digits of and the turn directions by the odd/even parity of the digits of (odd, clockwise and even, counterclockwise). Similarly, the curve in Figure 13(b) is determined by the digits of (radii) and (turn directions).
a) radius digit of , turn determined by parity of digits of
b) radius digit of , turn determined by parity of digits of
Figure 13: Random walks using digits of , , , and
References
[1] N. J. A. Sloane, editor, The On-Line Encyclopedia of Integer Sequences, https://oeis.org (as of Jan. 30, 2017). [2] W. Gilbert, “Arithmetic in Complex Bases,” Mathematics Magazine, 57(2), 1984, https://www.math.uwaterloo.ca/~wgilbert/Research/ArithCxBases.pdf. [3] K. Mitchell, Kerry Mitchell Art, http://www.kerrymitchellart.com (as of Jan. 30, 2017). [4] B Riley, Late Morning, http://www.tate.org.uk/art/artworks/riley-late-morning-t01032 (as of Jan. 30, 2017). [5] Lagrange Polynomial, https://en.wikipedia.org/wiki/Lagrange_polynomial (as of Jan. 30, 2017). [6] F. T. Adams-Watters and E. W. Weisstein, “Signature Sequence,” Mathworld—A Wolfram Web Resource, http://mathworld.wolfram.com/SignatureSequence. (as of Jan 31, 2017). [7] K. Mitchell, “Random Walks with Pi, http://spacefilling.blogspot.com/2014/03/randomwalks-with-pi. (as of Mar. 2014).