I am trying to write out the Hecke Operator; however, I don't know how to sum over all divisors of an integer. Could someone please give me some advice how to do that. Below is the Hecke Operator definition I use:

$$T_NZ(\tau)= \sum_{d|N}\sum_{\kappa=0}^{d-1}Z\left(\frac{N\tau/d +\kappa}{d}\right)$$

Many thanks!!

  • 1
    $\begingroup$ E.g. Sum[f[d], {d, Divisors[122]] $\endgroup$
    – Coolwater
    Jul 13, 2017 at 9:02
  • $\begingroup$ Thank you!! I got it.. $\endgroup$
    – user404302
    Jul 13, 2017 at 11:45

1 Answer 1


DivisorSum[] can be used for this:

hecke[f_, n_Integer?Positive, τ_] := 
      DivisorSum[n, Sum[Function[τ, f][(n τ/# + b)/#], {b, 0, # - 1}] &]

For example:

hecke[KleinInvariantJ[τ], 3, τ]
   KleinInvariantJ[τ/3] + KleinInvariantJ[3 τ] +
   KleinInvariantJ[(1 + τ)/3] + KleinInvariantJ[(2 + τ)/3]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.