Advertisements

I figured out the formula for determining the row (y) and column (x) position of an arbitrary odd positive integer on the chart I created and shared yesterday.

It gives the row and column, and also the quadratic polynomials satisfied by all the odd integers in the row and column, respectively.

This all bears further study.

Here are some outputs of sample runs:

Here is the Perl script code I wrote to do it:

```
#!/usr/bin/perl
use strict;
use warnings;
use POSIX qw/ceil/;
my $m = $ARGV[0];
my ($c, $r, $x, $y);
my ($xa, $xb, $ya, $yb);
$c = ceil( sqrt( $m ) );
$r = $c * $c - $m;
if ( ( $r % 2 ) == 0 ) {
$x = ( $c + 1 ) / 2 - $r / 2;
}
else {
$x = $c / 2 - ( $r - 1 ) / 2;
}
$y = $c + 1 - $x;
if ( $r > $c ) {
$x += ( $c - 1 );
$y -= $c;
}
$xa = 2 * $y - 1;
$xb = $y * $y - 3 * $y + 1;
$ya = 2 * $x - 3;
$yb = $x * $x - $x + 1;
print "$m is in row (y) $y, column (x) $x of the table.\n";
print " at the intersection of x^2 + ", $xa, "x + ", $xb, "\n";
print " and y^2 + ", $ya, "y + ", $yb, ".\n";
```

## Leave a Reply Cancel reply