      program freud2
c  displays the Freud's equations for x^(2m)
      integer*2 s(162374)
      logical fex
      character*80 fname0,fname,term
      integer p,pp,p1,p2,ds(10)
      data ds/0,12,57,221,772,2492,7557,21807,60474,162374/
 1    print *,' Freud''s equations for x^(2m), 1<=m<=10 . Give m. (stop if m outside 1..10)'
      read *,m
      if(m.lt.1.or.m.gt.10)stop
      if(m.eq.1)then
        print *,' F_n(x^2)= 2 (x_n)^2 '
        goto 1
      endif
      fname0='freud0xx.dat'
      fname='    '
      do i1=2,0,-1
       fname0(7:7)=char(48+i1)
c  '(assuming ascii)
       do i2=9,0,-1
        if(10*i1+i2.lt.m)goto 15
        fname0(8:8)=char(48+i2)
        inquire(file=fname0, exist=fex)
        if(fex)fname=fname0
        if(fex)print *,fname
       enddo
      enddo
   15 continue
      print *,'  verbose output?  (1=yes,  0=no)'
      read *,iverb
      open(unit=1,file=fname)
      is=ds(m)
      read(1,'(20i4)')(s(i),i=1,is)
      p=1
      do mm=2,m
       print '(2i8,'' (terms)     F_n(x^'',i2,'')='',i3,'' x_n times'')',p,s(p+1),2*mm,2*mm
c  F
       do i=0,s(p+1)-1
        pp=p+2+i*mm
        p2=pp+mm-1
        term='                    '
        write(term,'(''+'',i3,10(''('',i3,'')''))')s(pp),(s(pp+j),j=1,mm-1)
        if(iverb.eq.1)print '(a80)',term
       enddo
       do k=1-mm,0
        p1=p2+1
        print '(i7,''  (terms)     d F_n/d log x_(n'',i3,'') = '',i3,'' x_n x_(n'',i3,'') times'')',
     &    s(p1),k,2*mm,k
        do i=0,s(p1)-1
         pp=p1+1+i*(mm-1)
         p2=pp+mm-2
         term='                    '
         write(term,'(''+'',i3,10(''('',i3,'')''))')s(pp),(s(j),j=pp+1,p2)
         if(iverb.eq.1)print '(a20)',term
        enddo
       enddo
       p=p2+1
      enddo
      stop
      end
