Is Strong Number

This algorithm checks whether a given number is strong number or not. Strong numbers are the numbers whose sum of factorial of digits is equal to the original number.



									function IsStrongNumber($number)
{
	$fact;
	$num = $number;
	$sum = 0;

	while ($number != 0)
	{
		$fact = 1;

		for ($i = 1; $i <= $number % 10; $i++)
			$fact *= $i;

		$sum += $fact;

		$number = (int)($number / 10);
	}

	return $sum == $num;
}
								


Example

									$isStrongNumber = IsStrongNumber(145);
								


Output

									True