-1

I got a problem to solve. I need write a PHP scipt to calculate a factorial for a number from 1 to 1000, what seems easy, by it also says that "but if it gives INF for 999, your algorithm is wrong". I'm confused.

Ilya Spark
  • 157
  • 1
  • 2
  • 9

1 Answers1

2

There is function in php to do this

<?php

$fact = gmp_fact(999); // 999 * 998 * 997, ... etc
echo gmp_strval($fact)
?>

This returns the factorial , for reference http://php.net/manual/en/function.gmp-fact.php

Prags
  • 811
  • 5
  • 17