note 38970 added to ref.math

From: Date: Tue, 13 Jan 2004 18:47:57 +0000
Subject: note 38970 added to ref.math
Groups: php.notes 
Request: Send a blank email to php-notes+get-63468@lists.php.net to get a copy of this message
Here are are a nPr and a nPc function (had to define NaN - don't know, how to this the "rigth" way) <?php define (NaN,acos(1.01)); function nCr($n,$r){ if ($r > $n) return NaN; if (($n-$r) < $r) return nCr($n,($n-$r)); $return = 1; for ($i=0;$i < $r;$i++){ $return *= ($n-$i)/($i+1); } return $return; } function nPr($n,$r){ if ($r > $n) return NaN; if ($r) return $n*(nPr($n-1,$r-1)); else return 1; } ?> ---- Manual Page -- http://www.php.net/manual/en/ref.math.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38970 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38970&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38970&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63468) next »