code: def zeta_array(N, prec):
      """
      zeta(n) = A * pi**n / n! + B
  
      where A is a rational number (A = Bernoulli number
      for n even) and B is an infinite sum over powers of exp(2*pi).
      (B = 0 for n even).
  
      TODO: this is currently only used for gamma, but could
      be very useful elsewhere.
      """
      extra = 30
      wp = prec + extra
      zeta_values = [MPZ_ZERO] * (N + 2)
      pi = pi_fixed(wp)
      # STEP 1:
      one = MPZ_ONE << wp
      zeta_values[0] = -one // 2
      f_2pi = mpf_shift(mpf_pi(wp), 1)
      exp_2pi_k = exp_2pi = mpf_exp(f_2pi, wp)
      # Compute exponential series
      # Store values of 1/(exp(2*pi*k)-1),
      # exp(2*pi*k)/(exp(2*pi*k)-1)**2, 1/(exp(2*pi*k)-1)**2
      # pi*k*exp(2*pi*k)/(exp(2*pi*k)-1)**2
      exps3 = []
      k = 1
      while 1:
          tp = wp - 9 * k
          if tp < 1:
              break
          # 1/(exp(2*pi*k-1)
          q1 = mpf_div(fone, mpf_sub(exp_2pi_k, fone, tp), tp)
          # pi*k*exp(2*pi*k)/(exp(2*pi*k)-1)**2
          q2 = mpf_mul(exp_2pi_k, mpf_mul(q1, q1, tp), tp)
          q1 = to_fixed(q1, wp)
          q2 = to_fixed(q2, wp)
          q2 = (k * q2 * pi) >> wp
          exps3.append((q1, q2))
          # Multiply for next round
          exp_2pi_k = mpf_mul(exp_2pi_k, exp_2pi, wp)
          k += 1
      # Exponential sum
      for n in xrange(3, N + 1, 2):
          s = MPZ_ZERO
          k = 1
          for e1, e2 in exps3:
              if n % 4 == 3:
                  t = e1 // k**n
              else:
                  U = (n - 1) // 4
                  t = (e1 + e2 // U) // k**n
              if not t:
                  break
              s += t
              k += 1
          zeta_values[n] = -2 * s
      # Even zeta values
      B = [mpf_abs(mpf_bernoulli(k, wp)) for k in xrange(N + 2)]
      pi_pow = fpi = mpf_pow_int(mpf_shift(mpf_pi(wp), 1), 2, wp)
      pi_pow = mpf_div(pi_pow, from_int(4), wp)
      for n in xrange(2, N + 2, 2):
          z = mpf_mul(B[n], pi_pow, wp)
          zeta_values[n] = to_fixed(z, wp)
          pi_pow = mpf_mul(pi_pow, fpi, wp)
          pi_pow = mpf_div(pi_pow, from_int((n + 1) * (n + 2)), wp)
      # Zeta sum
      reciprocal_pi = (one << wp) // pi
      for n in xrange(3, N + 1, 4):
          U = (n - 3) // 4
          s = zeta_values[4 * U + 4] * (4 * U + 7) // 4
          for k in xrange(1, U + 1):
              s -= (
                  zeta_values[4 * k] * zeta_values[4 * U + 4 - 4 * k]
              ) >> wp
          zeta_values[n] += (2 * s * reciprocal_pi) >> wp
      for n in xrange(5, N + 1, 4):
          U = (n - 1) // 4
          s = zeta_values[4 * U + 2] * (2 * U + 1)
          for k in xrange(1, 2 * U + 1):
              s += (
                  (-1) ** k
                  * 2
                  * k
                  * zeta_values[2 * k]
                  * zeta_values[4 * U + 2 - 2 * k]
              ) >> wp
          zeta_values[n] += ((s * reciprocal_pi) >> wp) // (2 * U)
      return [x >> extra for x in zeta_values]
  
imports: import math
  import sys
  from .backend import xrange
  from .backend import MPZ, MPZ_ZERO, MPZ_ONE, MPZ_THREE, gmpy
  from .libintmath import list_primes, ifac, ifac2, moebius
  from .libmpf import round_floor, round_ceiling, round_down, round_up, round_nearest, round_fast, lshift, sqrt_fixed, isqrt_fast, fzero, fone, fnone, fhalf, ftwo, finf, fninf, fnan, from_int, to_int, to_fixed, from_man_exp, from_rational, mpf_pos, mpf_neg, mpf_abs, mpf_add, mpf_sub, mpf_mul, mpf_mul_int, mpf_div, mpf_sqrt, mpf_pow_int, mpf_rdiv_int, mpf_perturb, mpf_le, mpf_lt, mpf_gt, mpf_shift, negative_rnd, reciprocal_rnd, bitcount, to_float, mpf_floor, mpf_sign, ComplexResult
  from .libelefun import constant_memo, def_mpf_constant, mpf_pi, pi_fixed, ln2_fixed, log_int_fixed, mpf_ln2, mpf_exp, mpf_log, mpf_pow, mpf_cosh, mpf_cos_sin, mpf_cosh_sinh, mpf_cos_sin_pi, mpf_cos_pi, mpf_sin_pi, ln_sqrt2pi_fixed, mpf_ln_sqrt2pi, sqrtpi_fixed, mpf_sqrtpi, cos_sin_fixed, exp_fixed
  from .libmpc import mpc_zero, mpc_one, mpc_half, mpc_two, mpc_abs, mpc_shift, mpc_pos, mpc_neg, mpc_add, mpc_sub, mpc_mul, mpc_div, mpc_add_mpf, mpc_mul_mpf, mpc_div_mpf, mpc_mpf_div, mpc_mul_int, mpc_pow_int, mpc_log, mpc_exp, mpc_pow, mpc_cos_pi, mpc_sin_pi, mpc_reciprocal, mpc_square, mpc_sub_mpf
label_desc: Use image node_id 28 for calling a global function with example usage: zeta_array(N, prec) and returns: unknown