function reverse_factorial ($factorial
{
$current = 1;
while ($factorial > $current) {
if ($factorial % $current) return -1;
$factorial = $factorial$current
$current++;
}
if ($factorial == $current) return $current
else return -1;
}