₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,614 members, 8,512,773 topics. Date: Wednesday, 04 November 2026 at 12:04 AM

Toggle theme

Yemoll's Posts

Nairaland Forum › Yemoll's Profile › Yemoll's Posts

1 (of 1 pages)

Programming › Re: Simple Factorial Challenge by Yemoll: 2:42pm On May 23, 2016
Slyr0x:
Great job Jacob05. Your solution is more efficient.

Solution below as solved by someone on my team

bcscale(25);
$itotal = "0";
$xt = "0.7893";$ii = 1;
$yyy = "1";while ($ii <= 5000)
{
$y2 = intval(gmp_add($yyy,"1"wink);
$y3 = strval($y2);

$factit = gmp_fact($y2);

$at = bcdiv(gmp_mul("2", gmp_sub($factit,"1"wink), $factit);
$xtpow = bcpow($xt,$y2);

$anst = bcmul($at,$xtpow);

$itotal = bcadd($itotal,$anst);
$yyy = gmp_add($yyy,"1"wink;
$ii++;

}

echo "Solution: " .$itotal."<br />";
@slyrox if you run both scripts @jacob05's python and the php you uploaded, they are not providing the same output. So there is something wrong somewhere.

1 (of 1 pages)