      SUBROUTINE INFCTR(N, IFACT, IPOWER, NEXP, NPOWER)
C FACTOR N INTO ITS PRIME POWERS, NPOWER IN NUMBER.
C E.G., FOR N=1960=2**3 *5 *7**2, NPOWER=3, IFACT=2,5,7,
C IPOWER=8,5,49, AND NEXP=3,1,2.
      DIMENSION IFACT(8), IPOWER(8), NEXP(8)
      IP = 0
      IFCUR = 0
      NPART = N
      IDIV = 2
   10 IQUOT = NPART/IDIV
      IF (NPART-IDIV*IQUOT) 60, 20, 60
   20 IF (IDIV-IFCUR) 40, 40, 30
   30 IP = IP + 1
      IFACT(IP) = IDIV
      IPOWER(IP) = IDIV
      IFCUR = IDIV
      NEXP(IP) = 1
      GO TO 50
   40 IPOWER(IP) = IDIV*IPOWER(IP)
      NEXP(IP) = NEXP(IP) + 1
   50 NPART = IQUOT
      GO TO 10
   60 IF (IQUOT-IDIV) 100, 100, 70
   70 IF (IDIV-2) 80, 80, 90
   80 IDIV = 3
      GO TO 10
   90 IDIV = IDIV + 2
      GO TO 10
  100 IF (NPART-1) 140, 140, 110
  110 IF (NPART-IFCUR) 130, 130, 120
  120 IP = IP + 1
      IFACT(IP) = NPART
      IPOWER(IP) = NPART
      NEXP(IP) = 1
      GO TO 140
  130 IPOWER(IP) = NPART*IPOWER(IP)
      NEXP(IP) = NEXP(IP) + 1
  140 NPOWER = IP
      RETURN
      END
