note 63744 deleted from function.sqrt by tularis
| From: | tularis@php.net | Date: | Thu, 16 Feb 2012 16:33:24 +0000 |
| Subject: | note 63744 deleted from function.sqrt by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-186173@lists.php.net to get a copy of this message | ||
Note Submitter:
----
A much easier way to find perfect squares:
This method uses integer roots to find perfect squares instead of integer squares to find integer
roots.
<?
# initial value
$i = 0;
#set any limit you want
$setSomeLimit = 10000;
# do it! .... do it! ... do it!
for ($n = 1; $n < sqrt($setSomeLimit; $n++)
{
// Find the square
$s= $n * $n;
print "<br>perfect_square_root is of $s is $n";
}
?>