₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,331,230 members, 8,449,280 topics. Date: Tuesday, 21 July 2026 at 02:20 PM

Toggle theme

Yemoll's Posts

Nairaland ForumYemoll's ProfileYemoll's Posts

1 (of 1 pages)

ProgrammingRe: 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)