       parameter (M=9, NN=2**M)
       complex C(0:NN), D(0:NN), Z(0:NN)
       complex w, u, v

       DO 100 KK=1, 100

       pi=4.0*atan(1.0)
       w=cmplx(cos(-2*pi/NN), sin(-2*pi/NN))

       do 10 k=0, NN-1
          Z(k)=w**k
          C(k)=cos(5*2*pi*k/NN)
 10    continue

       do 20 n=0, M-1
          do 30 k=0, 2**(M-n-1)-1
             do 30 j=0, 2**n-1
                u=C(2**n*k+j)
                v=Z(j*2**(M-n-1))*C(2**n*k+2**(M-1)+j)
                D(2**(n+1)*k+j)=(u+v)/2
                D(2**(n+1)*k+j+2**n)=(u-v)/2
 30       continue

          do 40  j=0, NN-1
             C(j)=D(j)
 40       continue

 20    continue

 100   continue


       do 99 j=0, NN-1
c          write (11, *) C(j)
          print *, C(j)
 99    continue    

       stop
       end


