# Rhyme Scheme Enumeration

5/22/19

One aspect of poetry is rhyming. A rhyme scheme is how rhyming is done within a poem. For example, AAAA, would be a four line poem with every line rhyming. The poem ABAB, would be a four line poem, but with the first and third line rhyming, and the second and fourth line rhyming, and the rhymes A and B are different. A famous five line rhyming poem is AABBA, called a limerick. Here is an AABB, my

Freeverse 83
the moon hangs in the midnight sky A
a lemon drop or cyclops eye A
among uncountable stars the night B
is black between these bits of light B

It is important to note that these type of rhyme schemes only consider a very simple way of rhyming! In any case, the question is, how many possible rhyme schemes exist for a n line poem?

It turns out numbers that are the answer to that question are called Bell numbers, and are sequence A0001110 in the On-Line Encyclopedia of Integer Sequences. Note that Bell(n) includes rhyme schemes in which rhymes are not used at all, for example, ABCD. If you want all lines to rhyme with at least one other line, these are sequence number A000296 in the OEIS. In any case, here is a table for Bell(n) from n = 1 to 10

 n Bell(n) 1 1 2 2 3 5 4 15 5 52 6 203 7 877 8 4,140 9 21,147 10 115,975

For example, a 4 line poem has 15 possible rhyming structures.

But what is a general equation to calculate Bell(n)? Actually, there are a few. I will present the ones that I like the best.

Bell(n) = sum[S(n,k), k=0 to n]

where n is the nth row of the Bell number triangle or elements, and k is columns of the Bell number triangle or sets. The term S(n,k) is a Sterling number of the second kind. We can write

S(n,k) = (1/k!)*sum[(-1)i*nCr(k,i)*(k-i)n, i=0 to k]

Then we fix n, and make a sequence of these over k to get a row of the Bell number triangle

sequence( (1/k!)*sum[(-1)i*nCr(k,i)*(k-i)n, i=0 to k], k=0 to n)

For example, using n = 5 gives the sequence: 0, 1, 15, 25, 10, 1. Note that summing these gives Bell(5), or 52.

From Comtet (1974),

Bell(n) = ceiling((1/e)*sum[kn/m!, m=1 to n])

This is easier to work with because there is no infinite sum. There are also recurrence relations and integrals that give Bell(n), but I don't find these very satisfying.

Now, on to specifically listing out the rhyme schemes for n from 1 to 10.

A

AA, AB

## n = 3

AAA, AAB, ABA, ABB, ABC

## n = 4

AAAA, AAAB, AABA, AABB, AABC, ABAA, ABAB, ABAC, ABBA, ABBB, ABBC, ABCA, ABCB, ABCC, ABCD

## n = 5

AAAAA, AAAAB, AAABA, AAABB, AAABC, AABAA, AABAB, AABAC, AABBA, AABBB, AABBC, AABCA, AABCB, AABCC, AABCD, ABAAA, ABAAB, ABAAC, ABABA, ABABB, ABABC, ABACA, ABACB, ABACC, ABACD, ABBAA, ABBAB, ABBAC, ABBBA, ABBBB, ABBBC, ABBCA, ABBCB, ABBCC, ABBCD, ABCAA, ABCAB, ABCAC, ABCAD, ABCBA, ABCBB, ABCBC, ABCBD, ABCCA, ABCCB, ABCCC, ABCCD, ABCDA, ABCDB, ABCDC, ABCDD, ABCDE