Hecke Operator- sum over divisors of a number

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!!

• E.g. Sum[f[d], {d, Divisors[122]] – Coolwater Jul 13 '17 at 9:02
• Thank you!! I got it.. – user404302 Jul 13 '17 at 11:45

1 Answer

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]