PDA

View Full Version : squares

p4plus2
03-05-2008, 01:42 AM
I got bored in my class the other day so I started messing around with squares and how to make them without multiplying. Heres a php script demonstrating what I found:

<?php
\$previousnumber = 0;
for(\$i = 0; \$i < 100; \$i++){
\$number = \$previousnumber + \$i + \$i + 1;
\$previousnumber = \$number;
echo ("\$number");
echo ("<br>");
}
?>

basically
0 + 0 + 0 + 1 = 1
1 + 1 + 1 +1 = 4
4 + 2 +2 +1 = 9
answerbefore + current number to be squared + current number to be squared+ 1 = number squared
p+2x+1=y(formula I made to show it)

Point of this thread?
Show something intresting many people will never notice.

Fou-Lu
07-11-2008, 08:49 AM
Ok, the only reason why I saw this is cause the spamzors got it.
Interesting idea, but a lot of overhead. Too bad condition for 0^2 fails, the current calculation gives me 0^2 = 1, which is not accurate, 0^x where x > 0 is always equal to 0. Unfortunately it will take a few lines to generate a correct fix since it will shove a zero into the previous number.
Now do an optimized root calculation, that one's trickier ;)

p4plus2
07-17-2008, 05:55 AM
well this was just the theory behind powers with the starting number as an one.... No true point behind this script.