#
# This software is Copyright 2005 by Elsevier Inc.  You may use it
# under the terms of the license at http://perl.plover.com/hop/LICENSE.txt .
#



###
### factorial1
###

## Chapter 5 section 4.2

sub factorial {
  my ($n, $product) = @_;
  $product = 1 unless defined $product;
  return $product if $n == 0;
  return factorial($n-1, $n * $product);
}
