note 87636 deleted from gmp.examples by salathe

From: Date: Tue, 07 May 2013 07:14:23 +0000
Subject: note 87636 deleted from gmp.examples by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-194725@lists.php.net to get a copy of this message
Note Submitter: rks at rks dot org ---- I believe that "fact" computes the factorial of $x-1 not of $x. The for statement should be for ($i=2; $i <= $x; $i++) not for ($i=2; $i < $x; $i++) If you try to compute the factorial of 2 for example, the for loop will not be executed and the result will be 1.

« previous php.notes (#194725) next »