POETRY | MATHEMATICS | PROGRAMMING LANGUAGES
Prime Time Argument
All great love stories have one thing in common – You have to go against the odds to get there.
#!/usr/bin/perl;
use strict;
my $argument = <<__Prime_Time_Argument__;
It’s me
Then it’s you
Then it’s both of us
And together we aren’t two
There is no rhyme or reason to pursue this
We choose our own battles, yet we fight when no one wins
I’d rather lose an argument than to lose you to an argument
When our arguments are so intense, I begin to wonder where our love went
Then, I remember when we first met, and knowing then that I would fight for you in any war
Besides, I would rather spend my time counting the syllables in each verse of this Poem, as every one is a Prime Number
__Prime_Time_Argument__
print_argument($argument);
sub print_argument($argument) {
my $argument = shift;
$argument =~ s/\n\n/\n/g;
print $argument;
# That's all folks!
}
What Makes This Poem Unique?
The last verse in the Poem answers that question. The first eleven Prime numbers are:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, and 31
Count the syllables verse by verse, and you will see that each verse sequentially follows the first eleven Prime Numbers as illustrated in the following Excel Spreadsheet screenshot:
The total number of verses in the Poem is 11, which is a Prime Number too!
What About the Programming Code?
The code is written in Perl. (Practical Extracting and Reporting Language) Perl was created by Larry Wall, a Linguist, in 1987. In the early days of the Internet, the World Wide Web was literally created with Perl, and it is still popular today. Although I know many programming languages, Perl remains my programming language of choice. Even when I code in Java, I often build a prototype in Perl as a proof of concept, because Perl code can be created very quickly.
Perl is nicknamed “The Swiss Army Knife of Programming Languages.” You can do anything with Perl, and there is always “More than one way to do it.”
The point of the code is that not only is the Poem about an Argument, but it is itself an Argument to a Programming Subroutine!
Here’s How It Works – Line-by-Line
Note: Feel free to skip this section if you aren’t into programming code! The next sections are much more interesting and contain surprising facts about Prime Numbers, as well as two YouTube Videos from the world famous Spoken Word Artist, Poet, and Author, Harry Baker!
Before we start, I want to point out that this is a very simple Perl script, and that Perl can be used for extremely complicated programming.
- #!/usr/bin/perl The #! at the beginning of the line is called the “shebang” and is Linux/(*nix) lingo that is an indicator that what follows will be the directory path to the executable used to execute the code. Since I am using Perl to execute the program, the shebang contain the fully qualified path from the root to the perl executable. It also allows the code to be executed “standalone.” Note: If you are a Windows user only, you will notice that directory paths used in Linux/*nix use forward slashes (“/”). Windows use Hard Drive Letters, a colon, and backslashes (“\”) to delineate directory paths. So a Perl shebang line on Windows would be something like: #!C:\perl\bin\perl
- use strict; This tell the interpretor to generate a compile-time error if you access a variable without declaration, a runtime error if you use symbolic references, and a compile-time error if you try to use a bareword identifier in an improper way. You may not understand the above if you are not a programmer. So, in simpler terms. it just means that Perl will be closely watching to ensure that you write proper code. If you are a serious programmer, this is always used
- my $argument = <<__Prime_Time_Argument__; In Perl lingo, this is called a “heredoc.” What it does is print everthing that follows into the variable $argument as-is until it reaches a line that only contains the string __Prime_Time_Argument__ Note: Very few programming languages have this very cool feature!
- __Prime_Time_Argument__ This is where the “heredoc” terminates, as mentioned in 3. above.
- print_argument($argument); This is calling a subroutine named “print_argument” and what is contained within the parentheses ($argument) is called an “argument” in programming terms. What this does is send the conte9nts of the variable $argument, which was gathered in lines 3 and 4, and is the content of the Poem as is written on the page.
- sub print_argument($argument) { This is the subroutine mentioned in #5. In Perl, the interpretor knows that this line is the beginning of a subroutine as identified by the word “sub” followed by a space at the beginning of the line. The syntax for a subroutine in Perl is: • The word “sub” followed by a space • The name of the subroutine followed by a left parenthesis “(“ • Any “argument” passed to the subroutine. ($argument) • A left curly bracket “{“ indicating the start of the subroutine • The code withing the subroutine • A right curly cracket “}” indicating that the subroutine has ended
- my $argument = shift; This line just retreives the argument, $argument from within the parentheses ($argument). The keyword “shift” is a command in Perl that shifts the variable within the parentheses into a defined vaiable ($arument).
- $argument =~ s/\n\n/\n/g; In this line, the variable creasted in #8. above is going to be altered to remove the two hard returns (carriage returns) that follows each line in the Poem. This is a Medium thing. You see, whenever you press [Enter] on your keyboard when using the Medium Story Editor, it actully inserts not one new line, but two new lines.The only way to prevent that from happening is to hold down the [Shift] key, and then press [Enter]. The =~ is Perl sytax that indicates that a “regular expression” (regex) will follow. A tegular expression is used in many programming languages and is used to search for matches within a string, or it can be used as a search and replace operator. Perl has a very powerful, if not the most powerful Regular Expression Engine of all programming languages. What follows next is an optional space, then s/\n\n/\n/g. The “s” means “substitute. What follows is a search and replace regular expression in the form of “/replace what/” with “/with this/. “ The “replace what” and “something else” are enclosed in forward slashes (/) The “\n” indicates a new line (carriage return). Notice there are two of them: “\n\n” The “g” at the end meang “globally” So, in common language this line tells Perl to globally substitute any occurence of a new line followed immediately by another new line, with just one new line.
- print $argument; This is pretty straight forward. It simple means to print the contents of the string variable $argument, which in this case is everything between the “heredoc” lines, which is the Poem itself.
- # That's all folks! The “#” sign indicates that what what follows is a comment and is to be ignored when the program is executed.
- } The right curly bracket terminates the subroutine
So What Are Prime Numbers?
A Prime Number is a whole number (integer) greater than 1, whereby the number has only two factors – The number 1 and the number itself. All other numbers are referred to as Composite Numbers.
As illustrated above, Composite Numbers can be arranged into rectangles but Prime Numbers cannot.
Interesting and Surprising Facts about Prime Numbers
- Before the Great Internet Mersenne Prime Search and other distributed computing projects, Prime Numbers had rare practical applications in real-life outside of the world of acadamia.That has since changed drastically.
- Today the standard of modern encryption keys is up to 2048 bit with the RSA system. Decrypting a 2048 bit encryption key is nearly impossible in light of the number of possible combinations Prime Number.
- Quantum Computing, although in its infancy, has recently made leaps in moving forward it’s prior projected timeline to fully integrate the technology into private business and governmental agencies. Quantum computing has been found to achieve computing speeds thousands of times faster than today’s supercomputers. This computing power poses a very real theat to the secutity of presnt day encryption technology. As an Example, RSA encryption relies on the multiplication of very large prime numbers to create a semiprime number for its public key. Decoding this key without its private key requires this semiprime number to be factored in.
- Using a modern day computer, it would literally take trillions of years to hack an RSA-2048 encryption key!
Sounds pretty darn safe, right? Not so fast…
- A Quantum Computer with 4099 perfectly stable qubits could break that same RSA-2048 encryption key in just 10 seconds!
That’s pretty darn scary!
More Interesting and Surprising Facts Facts About Prime Numbers
- The largest known Prime Number (as of January 2022) is 2⁸²⁵⁸⁹⁹³³ –1, a number which has 24,862,048 digits when written in base 10. It was found via a computer volunteered by Patrick Laroche of the Great Internet Mersenne Prime Search (GIMPS) in 2018.
- In Mathematics, the Sieve of Eratosthenes is an ancient algorithm for finding all Prime Numbers up to any given limit.
Even More Interesting and Surprising Facts about Prime Numbers!
- The number 2 is the only even Prime Number
- There exists no known formula to distingush Prime Numbers from Composite Numbers.
- No number greater than 5 that ends in 5 is a Prime Number
- With the exception of 2 and 3, all Prime Numbers are either 1 or above a multiple of 6
- The number of Prime Numbers is infinite. This fact was initially proven by the ancient Greek mathematician Euclid.
- Cicadas appear during numbered intervals of 7, 13, and 17 years, all of which are Prime Numbers
Prime Time Humor!
In the Thai language, people laugh when they say “five!” In Thai, the English word “Five” translates in Thai to “H̄̂ā.” It is pronounced just like the English phrase for laughing, as in “Ha,ha, ha…”