PROGRAM eulerform
  IMPLICIT NONE
  
  DOUBLE PRECISION :: term, s
  DOUBLE PRECISION :: pi 
  INTEGER :: n

  pi = 4.0d0 * ATAN(1.0d0)

  s=0.0d0
  DO n =1,50000
     term = 12.0d0 / n / n &
          * COS(9.0d0 / (n*pi + SQRT((n*pi+3.0d0)*(n*pi-3.0d0))))
     
     s = s + term
  ENDDO

  PRINT *, s, -pi*pi/EXP(3.0d0)

END PROGRAM eulerform
