Ode to Prime Numbers

Primes offer poetry both subject matter and structure.

Current Issue

This Article From Issue

July-August 2013

Volume 101, Number 4
Page 246

DOI: 10.1511/2013.103.246

“No branch of number theory is more saturated with mystery and elegance than the study of prime numbers,” wrote Martin Gardner in his essay “Patterns and Primes.” It is therefore no wonder that prime numbers show up in another human endeavor that delves into mysteries in search of patterns and elegance—poetry. As a mathematician and poet, I have long been interested in this confluence.

Courtesy of Paul Ashwell.

Ad Right

Some poems, echoing the purpose of early poetic treatises on scientific principles, attempt to elucidate the mathematical concepts that underlie prime numbers. Others play with primes’ cultural associations. Still others derive their structure from mathematical patterns involving primes. Whatever the mode of introduction, the meeting of poetry and primes—“those exasperating, unruly integers that refuse to be divided evenly by any integer except themselves and 1,” as Gardner described them—is often an eventful one.

Poetic Mathematics

Gardner often quoted poems in his Mathematical Games column for Scientific American, and he wrote several essays on prime numbers. He could hardly have found a better poem for the subject than British poet Helen Spalding’s “Let Us Now Praise Prime Numbers,” which he reprinted in the essay “Strong Laws of Small Primes.” The poem captures elements that have made primes an object of fascination since the time of Euclid. Spalding (1920–1991) is herself a mysterious figure whose life is difficult to trace after her last publication in The London Magazine in 1961.

Let Us Now Praise Prime Numbers
Let us now praise prime numbers
With our fathers who begat us:
The power, the peculiar glory of prime numbers
Is that nothing begat them,
No ancestors, no factors,
Adams among the multiplied generations.

None can foretell their coming.
Among the ordinal numbers
They do not reserve their seats, arrive unexpected.
Along the lines of cardinals
They rise like surprising pontiffs,
Each absolute, inscrutable, self-elected.

In the beginning where chaos
Ends and zero resolves,
They crowd the foreground prodigal as forest,
But middle distance thins them,
Far distance to infinity
Yields them rare as unreturning comets.

O prime improbable numbers,
Long may formula-hunters
Steam in abstraction, waste to skeleton patience:
Stay non-conformist, nuisance,
Phenomena irreducible
To system, sequence, pattern or explanation.

—Helen Spalding

The poem’s first stanza alludes to the Fundamental Theorem of Arithmetic. This theorem states that every positive integer greater than 1 is either a prime number or can be expressed as a unique product of prime numbers. Thus the primes are the building blocks of the integers and, consequently, of the entire real number system. In the second and third stanzas, Spalding suggests how prime numbers appear among the other numbers: Scattered without a discernible pattern, they fan out and occur less frequently as the numbers grow larger. However, despite this reduction in frequency, an infinite number of primes exists. Euclid’s proof of the infinitude of prime numbers, circa 300 BCE, is considered to be one of the most elegant proofs in mathematics—a poem in its own right. Michael Szpakowski’s Proof, a Short Opera offers a poetic and musical rendition of this proof. The piece can be viewed at www.somedancersandmusicians.com/proof/.

In the poem’s final stanza, Spalding touches on one of the deep mysteries associated with prime numbers: our inability to pin them down with a formula. Prime numbers smaller than a given number N can be found through a technique called the Sieve of Eratosthenes—named for Eratosthenes (ca. 276–195 BCE), the Greek mathematician who discovered it. The “sifting” consists of a simple divisibility test and the systematic deletion of all the proper multiples of the prime numbers up to the largest prime smaller than the square root of N. The method works best when N itself is small. For N = 100, for example, the deletion leaves in the sieve the first 25 primes:

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97

Since the time of Eratosthenes, many techniques have been invented to “catch” prime numbers, but as yet no formula has been found that covers them all. In particular, it is notoriously difficult to produce very large primes. Neither has a pattern been found to predict their distribution within a given interval of numbers. In 2000, the Clay Mathematics Institute listed seven of the most important open problems in mathematics. The institute offers an award of $1 million to anyone who publishes a solution to one of these Millennium Prize Problems. One problem, the Riemann Hypothesis, formulated by Bernhard Riemann (1826–1866), celebrated its 150th anniversary in 2010. It is a conjecture about the zeros of the Riemann zeta function. The function, ζ, is defined for complex variables, s, and a value of s for which ζ (s) = 0 is called a zero of zeta. The zeta function was introduced by Leonhard Euler in the early 1800s as a function of a real variable. Riemann extended the function to complex numbers and established a connection between its set of zeros and properties of prime numbers. The Riemann Hypothesis is considered to be the most important open problem in pure mathematics, and its solution would advance our knowledge of the distribution of prime numbers. Tom Apostol’s poem, “Where Are the Zeros of Zeta of s?,” playfully imparts the excitement generated by the chase after its solution. It begins:

Where are the zeros of zeta of s?
G. F. B. Riemann has made a good guess;
They’re all on the critical line, saith he,
And their density’s one over 2pi log t.

This statement of Riemann’s has been like a trigger
And many good men, with vim and with vigor,
Have attempted to find, with mathematical rigor,
What happens to zeta as mod t gets bigger.

—Tom Apostol, from “Where Are the Zeros of Zeta of s?”

Many other questions about prime numbers remain unanswered. Some of these problems and their partial solutions, as well as the spell cast by primes on the mathematicians who study them, have also made their way into poetry.

Prime Culture

Prime numbers have applications in computational fields, including cryptography and statistics, as well as in many scientific domains, such as engineering and physics. They also offer what Richard Crandall and Carl B. Pomerance call, in their 2005 book Prime Numbers: A Computational Perspective, “cultural connections.” These cultural connections manifest themselves in poetry in a variety of ways.

The concept of primality is employed in poems as a metaphor for the intoxicating mysteries of life and human behavior. An example of this phenomenon is found in “Prime Numbers,” by Jim Mele.

Prime Numbers
Prime numbers,
I remember them
like drinks
following complicated folk laws.
Out in California
a friend visits a pebble
beach, indivisible
in this uncertain life.

—Jim Mele

The depth of the cultural connection between primes and poetry becomes more apparent when we examine the inclusion of specific prime numbers in poems. The affinity between numbers and words has roots in the invention of alphabetic writing by the Phoenicians in the 2nd millennium BCE, When numbers came to be denoted by letters of the alphabet. In ancient poetry, especially in the domain of magic, mysticism and divination, every word acquired the number value of the sum of its letters and every number attained the symbolic values of one or more words in whose spelling it appeared. Historian of mathematics David Eugene Smith notes that 3 and 7 “were chief among mystic numbers in all times and among all people.” This, he proposes, is because “3 and 7 are the first prime numbers—odd, unfactorable, unconnected with any common radix, possessed of various peculiar properties.” In other words, 3 and 7 acquired a special importance precisely because of their primality. Vestiges of such significance, combined with layers of cultural, sociological and historical meaning, allow prime numbers to evoke powerful images and emotions, both personal and collective. Poems featuring the prime number 7 exemplify this effect. Perhaps most notably, 7 appears in key religious texts. It shows up in the first poem of Genesis, the first book of the Bible, as well as in the New Testament, the Koran, and others. Seven also appears in the Epic of Gilgamesh —one of the earliest known works of literature, dated around 2,000 BCE. The contemporary poems “Reasons for Numbers,” by Lisel Mueller, and “How I Won the Raffle,” by Dannie Abse, reflect the layers of history and mystery that the number 7 carried with it into the present; both are excerpted below:

Because luck
is always odd
and the division
of history
into lean and fat

—Liesel Mueller, from “Reasons for Numbers”

I chose 7 because those ten men used to dance
around the new grave seven times.
Also because of the pyramids of Egypt;
the hanging gardens of Babylon;
Diana’s Temple at Ephesus;
the great statue of Zeus at Athens;
the Mausoleum at Halicarnassus;
the Colossus of Rhodes;
and the lighthouse of Alexandria.

—Dannie Abse, from “How I Won the Raffle”

An even earlier poem features 7 as a lucky number. Langston Hughes’s “Addition [1]” employs the form of a math problem to comment on the addition of “love” to “luck.”

Lewis Carroll’s classic poem, The Hunting of the Snark, mentions 7 in company of other numbers for an amusing mathematical effect. Do the math!

“Taking Three as the subject to reason about—
A convenient number to state—
We add Seven, and Ten, and then multiply out
By One Thousand diminished by Eight.

“The result we proceed to divide, as you see,
By Nine Hundred and Ninety and Two:
Then subtract Seventeen, and the answer must be
Exactly and perfectly true.

—Lewis Carroll, from The Hunting of the Snark

Aesthetics and Structure

Poems rarely call on prime numbers for their visual appeal. A notable exception is William Carlos Williams’s imagist poem, “The Great Figure.”

The Great Figure
Among the rain
and lights
I saw the figure 5
in gold
on a red
to gong clangs
siren howls
and wheels rumbling
through the dark city.

—Williams Carlos Williams

Williams’s poem makes clear the aesthetic quality of the figure 5 he describes. American artist Charles Demuth’s painting I Saw the Figure 5 in Gold was inspired by it. A series of multimedia works based on the poem are available at the website Poems that Go (poemsthatgo.com).

More often, numbers contribute to the structure of a poem. Poetry’s musicality depends not only on words but also on quantifiable structural elements, and formal poetry relies on counting: metrical feet, rhyme words, line length, number of lines in a stanza, number of stanzas in the poem and more. A certain amount of mathematical calculation, either formal or intuitive, is involved in free verse as well. And some nontraditional poetic structures and procedures rely explicitly on the mathematical properties of prime numbers.

One such technique employs the Fundamental Theorem of Arithmetic. To construct a poem using this theorem, you decide on the length of the poem and then number the poem’s lines consecutively from bottom to top, starting at 2. Then choose a word that stands for multiplication and a word that stands for exponentiation. The next step is to write the lines marked by prime numbers. Each line numbered with a prime is a building block of the other lines, much like the prime numbers build the positive integers. The first poem written with this structure was Carl Andre’s poem “On the Sadness.” My poem, “13 January 2009,” was also made using this approach. The form does not require the writer to note the mathematics that undergirds it, but in this instance the notation is part of the poem.

13 January 2009
12=22 x3 Anuk is dying for Anuk is dying in the
white of winter
11 The coldest month
10=2x5 Anuk is dying in the falling snow
9=32 The white of winter for Anuk is dying
8=23 Anuk is dying for the white of winter
7 The drift of time
6=2x3 Anuk is dying in the white of winter
5 The falling snow
4=22 Anuk is dying for Anuk is dying
3 The white of winter
2 Anuk is dying
1 .

—Sarah Glaz

Here the word in stands for multiplication, and the word for stands for exponentiation. The poem is generated from the prime numbered lines—2, 3, 5, 7, and 11, which are written first—as follows: Factor each nonprime line number into a product of powers of distinct primes. For example, 12 = 22 x 3. The primes appearing in the number 12, arranged in increasing order, are 2 and 3. Line 2 is: Anuk is dying, and line 3 is: The white of winter. To construct line 12, replace the number 2 with line 2, the number 3 with line 3, multiplication with in and exponentiation with for. This makes line 12: Anuk is dying for Anuk is dying in the white of winter. The same procedure is used to generate each line of the poem. When the poem is read aloud, the echo created by the repetition of prime-numbered lines evokes an elegiac mood.

Another method involves the aesthetic manipulation of very large primes. Jason Earls’s concrete prime poem, “Lighght Prime” (shown below) is based on Aram Saroyan’s poem, “Lighght.” (The history of this poem, which engendered considerable controversy when it was first published, is worth looking up.)

Earls used zeroes and ones to create a visual representation of the poem. The word “lighght” appears in the interior of a rectangular array of digits, all of which are 0s and 1s. Taking the digits of this rectangular array and placing them in the same order on a straight line creates a long number. Multiplying this number by 101280, and then subtracting 1, yields a very large prime number. Verifying that this number is indeed prime involves the use of a computer program. Earls’s book, The Lowbrow Experimental Mathematician, includes additional information on this poetic form and more concrete prime poems.

Yet another technique for constructing poems involves the prime number 7. This method, called the n + 7 algorithm, was invented by the Oulipian poet Jean Lescure. The literary movement known as Oulipo—Ouvroir de Litterature Potentielle (Workshop of Potential Literature)—was founded by Raymond Queneau in 1960. Its members invented constraints that generate literature; many of these constraints are mathematical. The n + 7 algorithm replaces each noun in a given poem with the seventh noun that follows in a specified dictionary. Mathematically, the procedure is a function on the set of nouns—one that “translates” each noun by 7 units. The results are often amusing. Computer programs make it easy to run this algorithm on longer texts, and to do so using numbers other than 7. You can try out the procedure using a dictionary or at www.spoonbill.org/n+7/.

Whether they are invoked as lucky numbers, employed as generative constraints, or just lauded in all their unruliness, primes in poetry lend both elegance and unpredictability. This dual nature—both exemplar and irritant—is familiar to poetry lovers. “Stay non-conformist, nuisance,” Spalding urges the primes. It’s a directive that the best poems often follow as well.


An earlier version of this essay appeared as “The Poetry of Prime Numbers” in the Proceedings of Bridges Coimbra , 2011, pp. 17–24. For permission to reprint their poems, we are thankful to Jim Mele and Jason Earls. “Addition [1]” is from The Collected Poems of Langston Hughes, by Langston Hughes, edited by Arnold Rampersad with David Roessel, associate editor, copyright 1994 by the estate of Langston Hughes. Used by permission of Alfred A. Knopf, a division of Random House, Inc. “The Great Figure,” from The Collected Poems of William Carlos Williams, vol. 1, 1909–1939, by William Carlos Williams, is copyright 1938 by New Directions Publishing and is reprinted by permission.


  • Abse, D. 2000. Be Seated Thou . Rhinebeck, New York: The Sheep Meadow Press.
  • Crandall, R. E., and C. Pomerance. 2005. Prime Numbers: a Computational Perspective. New York: Springer.
  • Earls, J. 2010. The Lowbrow Experimental Mathematician . Raleigh, NC: Pleroma Publications.
    • Gardner, M. 2005. Martin Gardner’s Mathematical Games CD: The 6th Book of Mathematical Diversions (1971). Washington, DC: Mathematical Association of America.
    • Glaz, S. 2010. “Poetry inspired by mathematics.” Proceedings of Bridges Pécs , 35–42.
    • Glaz, S. 2011. “13 January 2009.” Recursive Angel , May–June.
    • Glaz, S., and J. Growney, eds. 2008. Strange Attractors: Poems of Love and Mathematics. London: CRC Press/AK Peters.
    • Jennings, E., ed. 1961. An Anthology of Modern Verse 1940–1960 . London: Methuen.
    • Mueller, L. 1986. Second Language . Baton Rouge: Louisiana State University Press.
    • Saroyan, A. 2007. Complete Minimal Poems of Aram Saroyan . New York: Ugly Duckling Presse.
    • Smith, D. E. 1958. History of Mathematics, volume II. Mineola, NY: Dover Publications.
    • Williams, W. C. 1985. Selected Poems of Williams Carlos Williams . New York: New Directions.