Behind the Numbers

Behind the Numbers
Sven Gelbhaar
05.11.2018

Beauty in Mathematics comes from — among other things — concision. To that
end, allow me to reduce the original equation for the solving of a perfect
square using just addition and subtraction into something that looks a lot more
concise. The original formula published back in April of 2011 was:

X² = (x-1) + ((x – 1)² – (x – 1)) + ((x – 1)² – (x – 1)) – ((x – 2)² – (x – 2))

  • 3

Algebra agrees that the formula is valid for all reals,
but that alone doesn’t necessitate that it’ll crunch out nothing but perfect
squares. Let’s pretend that there is a certain formula that does in fact do so.
What would it look like? I could say it looks exactly like mine above, but
that would be presupposing my premise, and I brook no circular reasoning. It
would have to allow X² to equal itself, only spelled out using polynomials that
reflect the table of perfect square constituents. The scope of possible
arrangements is unbounded, but this one here illustrates how they should
operate. I wouldn’t be surprised if some of you came up with easier and more
intuitive renditions.

Having come up with a formulation of X², we can easily convert this into source
code for all modern-day programming languages. I have, as I stated back in
2011, run this formula in PERL and verified that the formula works up to the
100th iteration. You are welcome to run your own verification, or better still:
run a benchmark of how fast a list of 100 perfect squares can be generated with
this formula versus X*X.

9/7/2024:
I found an easier formula that isn’t as math intensive.

X^2 = (X-1)^2 + (x-1) + (x-2) + 2

Let’s try to verify it by hand first.

2×2=4
3×3=9
4×4=16
5×5=25

5^2 = 25 = 16 + 4 + 3 + x | x = 2
4^2 = 16 = 9 + 3 + 2 + x | x = 2

Let me see if a quick PERL program/script can authenticate it for the first
hundred squares where x > 2.

You’ll need the PERL Interpreter from activestate.com (for Windows computers)
or install the package “perl” in your package manager for *NIX computers.

!/usr/bin/perl

Simple test to check if the perfect-square

formula is correct.

Sven Gelbhaar, 9/7/2024

use warnings;
use strict;

my $status = 1;
my $ProposedSquare = 0;

for (my $x = 3; $x <= 100; $x++) {
$ProposedSquare = ((($x-1) * ($x-1)) + ($x-1) + ($x-2) + 2);

    if (($x * $x) != $ProposedSquare) {
        print "The formula doesn't work for $x to the second power\tx^2 = $x*$x while proposed square is $ProposedSquare\n";
        $status = 0;
        }
    else { 
        print "The formula works for $x to the second power\n";
    }

}

if ($status) { print “No errors found.\n”; }
else { print “Errors found\n”; }
exit

End of Program

I assure you that the formula works perfectly well up to the first 100
perfect squares. Maybe change the bounds a little in the program above
and see how long it can go before your computer can’t handle the large
numbers anymore.

On a closing note:
I suppose I have two constants now. + 3 and + 2 (known as the Gelbhaar
Constants).

Leave a Comment

Your email address will not be published. Required fields are marked *