I’ve written a perl script to produce the “Beehive Plots” that I am currently using to search for patterns and relationships between odd positive integers, their (Adjusted) Ceiling Squares, and their Fermat factorizations, if they have them. Remember that to each possible factorization of a positive odd integer m=ab, where a and b are also positive odd integers, there corresponds an expression of m as the difference of two perfect squares, m=s^{2}-t^{2}, where s=(a+b)/2 and t=(|a-b|)/2. The Beehive Plots, my invention, are scatter plots for particular values of m of successive attempts, starting with the Adjusted Ceiling Square of m and increasing by 2, to find a pattern that will lead to the perfect squares s and t. The Adjusted Ceiling Square is the least perfect square greater than m that has the same odd/even property as (m+1)/2.

These plots may help me gain greater understanding and ability to see the patterns of the remainders as the minuend perfect square is raised higher and higher. The shape of the plots, together with the dots’ property of making a “bee line” for the solution near the bottom of them, inspired their name. I was thinking of an old=fashioned cartoon or childrens’ book style of drawing beehives. In reality, these are the inverted bottoms of parabolae, I think, due to the quadratic nature of what is going on with Fermat factorization.

This screen capture shows the scatter plots of the .csv file outputs for two different integers, one the 2023 value I selected and shared already to this blog in a typeset-graphics version for an earlier New Year’s post, and one a ten-digit discrete semiprime I’ve studied extensively.

Here is the Perl script code. One simply runs it with the integer argument, and uses “>” to send the output to a .csv file of one’s choice, since it is in that format.

```
#!/usr/bin/perl
use strict;
use warnings;
use POSIX qw/ceil/;
my $m = $ARGV[0];
die "Exiting. $m is not an odd positive integer.\n"
unless ( $m > 0 && ( $m % 2 ) == 1 && ceil( $m ) == $m );
my $m_odd_even = ( ( $m + 1 ) / 2 ) % 2;
my $c = ceil( sqrt( $m ) );
my ( $r, $rsq, $rsqm2, $lp, $rp, $cp, $nc, $lx, $bx, $rx, $len );
my $not_done = 1;
if ( ( $c % 2 ) != $m_odd_even ) {
$c++;
}
$len = 1;
while ( $not_done ) {
$nc = 0 - $c;
$r = $c * $c - $m;
$rsq = ceil( sqrt( $r ) );
if ( ( $rsq * $rsq ) == $r ) {
$not_done = 0;
}
else {
if ( ( $rsq % 2 ) == $m_odd_even ) {
$rsq++;
}
$lp = $c * $c - $rsq * $rsq;
$rsqm2 = $rsq - 2;
$rp = $c * $c - $rsqm2 * $rsqm2;
$cp = ( $lp + $rp ) / 2;
$lx = $lp - $cp;
$bx = $m - $cp;
$rx = $rp - $cp;
print "$lx,$nc\n$bx,$nc\n$rx,$nc\n";
}
$c += 2;
}
```

The game is once again afoot.

## Leave a Reply Cancel reply