LOGOLOG
a weblog of wordplay by Eric Harshbarger Palindromic SubstringsI recently wrote a script to scan texts and extract the longest palindromic substring therein (all non-letter characters, like spaces, punctuation, and numerals, are ignored). It works quite efficiently, and I was able to quickly search through literary texts as long at Melville's Moby Dick, and Tolstoy's War and Peace in a matter of seconds. Here are some interesting results after scanning through 100 of the most popular public domain texts downloaded from Project Gutenberg on 5 December 2021:
Mary Shelley's Frankenstein contains a few 9-letter substrings:
Nine letter examples are fairly common; many literary works of any length contain at least one such example. Jane Austen's Pride and Prejudice contains quite a few:
Nathaniel Hawthorne's, The Scarlet Letter, contains this 10-letter substring:
Kate Chopin's The Awakening has an 11-letter substring that originates from a single word:
Herman Melville's Moby Dick has a 12-letter:
Charles Dicken's A Christmas Carol has a longer one at 13 in length, but it is the not-very-interesting:
Niccolo Machiavelli's The Prince has a much more interesting 13-letter one:
The King James Version of the Bible clocks in with its longest substring at 13-letter:
Mark Twain's Advetures of Huckleberry Finn has a 14-letter:
And The Brothers Karamazov by Fyodor Dostoyevsky has the 14-letter:
W. E. B. Du Bois's The Souls of Black Folk extends a common "...ERE..." construction across two sentences for the 15-letter:
Dicken's Great Expectations has this 15-letter substring:
Dickens seems to have a knack for palindromic inclusions as his A Tale Of Two Cities has an even longer one at 17-letters:
Henry David Thoreau's Walden... has this 17-letter onomatopoeia:
Should we be surprised that James Joyce's Ulysses has the longest that I've yet found? Albeit a rather boring 20 letters:
If you are interested in scan other texts, you may use this webpage I have created: Scan Text For Longest Palindromic Substring. -- Eric
[6 December 2021]
|
Archive
|
|||||
Leave a comment on LOGOLOG about the article: Palindromic Substrings |
||||||
|
||||||