  We consider two motivic generating functions defined on a variety, and reveal
their tight connection. They essentially count torsion-free bundles and
zero-dimensional sheaves.
  On a reduced singular curve, we show that the ``Quot zeta function'' encoding
the motives of Quot schemes of 0-dimension quotients of a rank $d$ torsion-free
bundle satisfies rationality and a Serre-duality-type functional equation. This
is a high-rank generalization of known results on the motivic Hilbert zeta
function (the $d=1$ case) due to Bejleri, Ranganathan, and Vakil (rationality)
and Yun (functional equation). Moreover, a stronger rationality result holds in
the relative Grothendieck ring of varieties. Our methods involve a novel
sublattice parametrization, a certain generalization of affine Grassmannians,
and harmonic analysis over local fields.
  On a general variety, we prove that the ``Cohen--Lenstra zeta function"
encoding the motives of stacks of zero-dimensional sheaves can be obtained as a
``rank $\to\infty$'' limit of the Quot zeta functions.
  Combining these techniques, we prove explicit results for the planar
singularities associated to the $(2,n)$ torus knots/links, namely, $y^2=x^n$.
The resulting formulas involve summations of Hall polynomials over partitions
bounded by a box or a vertical strip, which are of independent interest from
the perspectives of skew Cauchy identities for Hall--Littlewood polynomials,
Rogers--Ramanujan identities, and modular forms.
