The figures I call N-Grams are based on the mathematics behind the figure known as the Enneagram. Its graphic representation is based on the repeating patterns of digits in the fractions 1/3 (0.333…, 0.666…, and 0.999…/0.000…- these last two both represented by the top point) and 1/7 (0.142857142857… and the ever-present 0.999…/0.000..) in base ten.

The top point of each N-Gram represents both the smallest and largest digit for the relevant number base – 0 and 9 for base ten. When dividing by any integer less than the base, no repeating patterns use these digits (except for 0/N = 0.000… and N/N = 1.000… = 0.999… – for bases other than ten, replace the “9” with that base’s largest digit). I use a somewhat different convention than the usual way the enneagram is drawn for single repeating digits. So for division by 3 (in base ten), I use small circles at the top 0/9 point and at 3 and 6 (1/3 = 0.333…, 2/3 = 0.666…) rather than connecting these points with a triangle.

When there are limited or no repeating patterns of digits produced by a division, the resulting N-Gram is partially or fully gray. These occur when the number base and the divisor have a prime factor in common. Further down this page I show the N-Grams by number base and by divisor. The next diagram shows the N-Grams for base ten. (These form one row in the “by number base” diagram.) The number under each is the divisor for that N-Gram. Note that the circles for 2, 4, 5, 8 and ten are fully gray. All the prime factors (2 and 5) for these divisors are also prime factors for the base, ten. Hence the division quickly “zeroes out” (e.g., in base ten, 1/5 = 0.20, 1/4 = 0.250). The circle for 6 is partially gray, because its prime factor 3 generates a repeating pattern (2/6 = 0.333…, 4/6 = 0.666…), whereas its prime factor 2 does not.

Base Ten N-Grams
Base Ten N-Grams

N-Grams by Base

Each diagram below graphically represents any digit-patterns formed when dividing by some number in an equal or larger number base. Each row of diagrams below show the results of division using a given number base, the base shown in the left-most diagram. This organization points out many regularities in the patterns. For instance, division by a number one less than the base yields single-digit repeating patterns (e.g., in base ten, 1/9 = 0.111…, 5/9 = 0.555…). There is also a strong regularity in the patterns on either side of the vertical center line for the odd-numbered bases. Looking more closely, the patterns equidistant from this center line nest with each other. To see this more clearly, see the diagram for Paired N-Grams, below.

Paired N-Grams

The diagram below takes the N-Grams by Base diagram (above) and folds it in half. The simpler patterns that were on the right of the center line are displayed in red below. The result is a pair of patterns that (whenever the two divisors have no prime factors in common with the number base) use every digit once (the exception being the top point, which occurs in every N-Gram.

Paired N-Grams to13 lg

N-Grams By Divisor

This arrangement of the N-Grams, where division by a given integer is represented in one row of the diagram, brings out how each pattern in the row repeats regularly. The length of the sequence of distinct patterns equals the divisor. The first pattern, where the divisor is the same as the number base, yields only the top-point pattern that is in every N-Gram [ N/N = 1.000…=0.999… ]. This is the “null” pattern, with minimal repetitive activity. This patter recurs whenever all the prime factors of the divisor are also prime factors in the number base. Examples are division by 4, 8, or 16 in any even-numbered base, or division by 9 or 27 in any base divisible by 3. When the number base is one more than the divisor, you get the same simple pattern for every divisor – a repetition of a single digit. For instance, in base ten, 1/9 = 0.111…, 2/9 = 0.222…, and so on. The set of N distinct patterns formed by division by N repeats starting at 2N, at 3N, and so on. For instance with division by 5, the patterns for[ 6, 11, 16, …] are basically the same, as are the patterns for [7, 12, 17, …] and [8, 13, 18, …] and [9, 14, 19, …].

N-Grams by Divisor 96ad

Second Power N-Grams (S-Grams)

Second Power N-Grams, first through fifth
S-Grams, S1 through S5

There’s a particular sequence of paired N-Grams that I call second power N-Grams; Tony Blake calls the figures in this sequence S-Grams. I’m going to start using the names S1, S2, etc. for: the 1-gram (S1), 4-gram (S2), 9 (ennea)-gram (S3), 16-gram (S4), 25-gram (S5), … (having respectively 1, 4, 9, 16, 25, … points around the perimeter, representing bases 2, 5, 10, 17, 26, …) with divisions by 1&1, 2&3, 3&7 (the enneagram), 4&12, 5&21, …. The header of this site has images of the first four of these. I will be trying various animations for the larger ones (see below). I’ve put the numerical sequences for these figures, S2 through S11 (4-gram through 121-gram) # in a PDF, also # an A4-sized version. If you open one of these, you will see that almost all of the patterns are of length 6, with a new pattern of 2 (from the fraction 1/3) in every third S-Gram (S2, S5, S8 and S11). The pattern of 2 in S2 grows, in the following S-Grams, to a pattern of 6, then to 2, 3, 4, … patterns of 6.The new patterns of 2 in S5. S8, S11, … each grow in the same manner. By the time we get to S11 (base 122), there are 9 patterns of 6 “grown” from the first pattern of 2, 6 patterns of 6 from the 2nd, 3 patterns of 6 from the 3rd, and a new pattern of 2 that will grow as have the others. When I first encountered this extreme regularity, I was surprised.

I drew the figure to the right in 2000. It starts at its base with the simplest of the S-Grams, S1 (in perhaps-mystic terms there is an “invisible” S0 below it) through S5. These figures have no arrows to indicate direction of flow. The colors were meant to bring out the growth of the length 2 and 6 sub-patterns.


Division by 7 in bases 10, 17, 24, and 31

To make it easier to see what changes with an increasing number base, I’ve constructed two ways to show division by 7 in bases 10, 17, 24, and 31. [The # animated GIF is more nimble, the # matched web pages let you wait and then click to see the next image in sequence, but loading a new web page for each click makes it slow. Once they’ve each been loaded, going back & forth is nimble.] Each diagram in the sequence shows division by 7 as a pattern in red. The complementary pattern (that touches all the other points around the circle) is represented by 3 black dots in base 10, and by blue lines in the other bases. The figure in base 31 and in base 10 (last and first figures in the sequence) have in common 3 anchor points which are in precisely the same points in the two diagrams. The blue complementary pattern in base 24, division by 17, yields a single figure with 16 points along its path (and, the ever-in-common top point). The complementary pattern in base 31, division by 24, yields 9 pairs of points (2-digit sequences) and 6 single points (at 0, 1/6, 1/3, 1/2, 2/3, and 5/6).


The header for this site has figures S1 through S4; this # animated GIF cycles through the figures for S5, S6, and S7.
To highlight sequences within one figure, this # animated GIF (for #7) has 1/43, 2/43, 3/43, 4/43 and 5/43 in red and the sequences for 9/43 and 10/43 in blue. Together, these seven patterns of length 6 (along with the ever-present zero-point) cover all the manifestations of dividing-by-43 in base 50.

Other references

For the time being, you can find some of what I wrote about a decade ago on N-Grams at .

Shane Roberts has taken the same idea in a similar direction, calling his diagrams Rotagrams. He has produced a CD titled Number Nature: An Introduction to Rotagram Systems. It is referenced at OCLC WordCat and  the National Library of Australia’s catalogue. Shane has said I could share his email, systemlover at hotmail dot com. His diagrams differ from mine in that they include non-repeating patterns, e.g., .125 for 1/8 (base ten) and division by numbers larger than the number base.

For exploring divisions by numbers larger than a number base, I would suggest it would be fruitful to use powers of the number base. For instance, rather than over-driving base 3, use powers of 3: 9, 27, 81, 243 – I’d start with the smallest power of 3 larger than the divisor. This would bring order to the otherwise chaotic-appearing sequences. For instance, in base 27, each digit represents a unique 3-digit sequence in base 3.

Balanced Odd Base N-Grams

For odd number bases using balanced digits (see Balanced Ternary), NGram-like patterns are going to be somewhat different – see this page.


Leave a Reply