Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: squares

  1. #1
    Regular Coder
    Join Date
    Mar 2008
    Posts
    103
    Thanks
    1
    Thanked 8 Times in 8 Posts

    squares

    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 Code:
    <?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.
    Last edited by p4plus2; 03-05-2008 at 04:11 PM. Reason: accidently put square root not just squared :P

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    Regular Coder
    Join Date
    Mar 2008
    Posts
    103
    Thanks
    1
    Thanked 8 Times in 8 Posts
    well this was just the theory behind powers with the starting number as an one.... No true point behind this script.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •