Selasa, 03 September 2013

PHP Indonesia - Facebook: NEed Help Can any one make LCM prrogram in PHP ?

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
Creating iOS Games: Beginner Course

Marin Todorov teaches you how to create an iPhone game easily and simply using Cocos2d in this $99 online course.
From our sponsors
NEed Help Can any one make LCM prrogram in PHP ?
Sep 3rd 2013, 13:26, by ĦüRtéd ǷwIncḗ

ĦüRtéd ǷwIncḗ 1:26pm Sep 3
NEed Help
Can any one make LCM prrogram in PHP ?

Gunawan Mujur Wibisono 1:28pm Sep 3
lcm? what is lcm??

ĦüRtéd ǷwIncḗ 1:28pm Sep 3
least common multiple

Gunawan Mujur Wibisono 1:32pm Sep 3
like what?

Remo Harsono 1:36pm Sep 3
.
function lcm_arr($items){
//Input: An Array of numbers
//Output: The LCM of the numbers
while(2 <= count($items)){
array_push($items, lcm(array_shift($items), array_shift($items)));
}
return reset($items);
}

function gcd($n, $m) {
$n=abs($n); $m=abs($m);
if ($n==0 and $m==0)
return 1; //avoid infinite recursion
if ($n==$m and $n>=1)
return $n;
return $m<$n?gcd($n-$m,$n):gcd($n,$m-$n);
}

function lcm($n, $m) {
return $m * ($n/gcd($n,$m));
}

not yet tested, but seems ok

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar