PROGRAM Ramanujan_identity !https://en.wikipedia.org/wiki/Srinivasa_Ramanujan#Mathematical_achievements
  USE, INTRINSIC :: ISO_Fortran_env, qp=>REAL128 !modern QUAD PRECISION
  IMPLICIT NONE
  INTEGER :: n, number
  REAL(qp) :: sum_left, term_left, left_left, sum_right, term_right, left_right, left, middle, right
  REAL(qp), PARAMETER :: theta = 0.0_qp !less than PI
  REAL(qp), PARAMETER :: PI = ATAN2(0.0_qp, -1.0_qp) !mathematical constant
  WRITE(6, '(a6)', advance='no') "  n = "
  READ *, number
  sum_left = 0.0_qp
  sum_right = 0.0_qp
  sum: DO n = 1, number
    term_left = COS(FLOAT(n) * theta) / COSH(FLOAT(n) * PI)
    sum_left = sum_left + term_left
    term_right = COSH(FLOAT(n) * theta) / COSH(FLOAT(n) * PI)
    sum_right = sum_right + term_right
  END DO sum
  left_left = (1.0_qp + 2.0_qp * sum_left)**(-2)
  left_right = (1.0_qp + 2.0_qp * sum_right)**(-2)
  left = left_left + left_right
  middle = 2.0_qp * GAMMA(3.0_qp / 4.0_qp)**4 / PI
  right = 8.0_qp * PI**3 / GAMMA(1.0_qp / 4.0_qp)**4
  WRITE(6, '(f36.32)') left
  WRITE(6, '(f36.32)') middle
  WRITE(6, '(f36.32)') right
END PROGRAM Ramanujan_identity