note 71502 added to ref.math
| From: | barry at megaspace dot com | Date: | Sat, 02 Dec 2006 17:14:13 +0000 |
| Subject: | note 71502 added to ref.math | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120232@lists.php.net to get a copy of this message | ||
Here's a least common denominator (lcd) function:
$array = array(3,4,6,8,18,2);
function lcd($array,$x) {
$mod_sum = 0;
for($int=1;$int < count($array);$int++) {
$modulus[$int] = ($array[0]*$x) % ($array[$int]);
$mod_sum = $mod_sum + $modulus[$int];
}
if (!$mod_sum) {
echo "LCD: ".($array[0]*$x)."\n";
}
else {
lcd($array,$x+1);
}
}
lcd($array,1);
----
Server IP: 66.163.161.117
Probable Submitter: 68.160.203.170
----
Manual Page -- http://www.php.net/manual/en/ref.math.php
Edit -- https://master.php.net/note/edit/71502
Del: integrated -- https://master.php.net/note/delete/71502/integrated
Del: useless -- https://master.php.net/note/delete/71502/useless
Del: bad code -- https://master.php.net/note/delete/71502/bad+code
Del: spam -- https://master.php.net/note/delete/71502/spam
Del: non-english -- https://master.php.net/note/delete/71502/non-english
Del: in docs -- https://master.php.net/note/delete/71502/in+docs
Del: other reasons-- https://master.php.net/note/delete/71502
Reject -- https://master.php.net/note/reject/71502
Search -- https://master.php.net/manage/user-notes.php