********************************************************************************
*                                                                              *
*  2DHF version 1-2003                                                         *
*  Copyright (C) 1996  Jacek Kobus, Leif Laaksonen, Dage Sundholm              *
*                                                                              *
*  This software may be used and distributed according to the terms            *
*  of the GNU General Public License, see README and COPYING.                  *
*                                                                              *
********************************************************************************
c ### factor ###
c
c     Calculates the factorial of n.
c
      function factor(n)
      implicit integer*4 (i-n)
      implicit real*8 (a-h,o-z)		

      factor=1.d0
      if (n.eq.0) return
      do i=1,n
         factor=dble(i)*factor
      enddo	
     
      return
      end
