  We consider pairing of itinerant fermions in a metal near a quantum-critical
point (QCP) towards some form of particle-hole order (nematic,
spin-density-wave, charge-density-wave, etc). At a QCP, the dominant
interaction between fermions comes from exchanging massless fluctuations of a
critical order parameter. At low energies, this physics can be described by an
effective model with the dynamical electron-electron interaction $V(\Omega_m)
\propto 1/|\Omega_m|^\gamma$, up to some upper cutoff $\Lambda$. The case
$\gamma =0$ corresponds to BCS theory, and can be solved by summing up
geometric series of Cooper logarithms. We show that for a finite $\gamma$, the
pairing problem is still marginal (i.e., perturbation series are logarithmic),
but one needs to go beyond logarithmic approximation to find the pairing
instability. We discuss specifics of the pairing at $\gamma >0$ in some detail
and also analyze the marginal case $\gamma = 0+$, when $V(\Omega_m) = \lambda
\log{(\Lambda/|\Omega_m|)}$. We show that in this case the summation of Cooper
logarithms does yield the pairing instability at $\lambda \log^2{(\Lambda/T_c)}
= O(1)$, but the logarithmic series are not geometrical. We reformulate the
pairing problem in terms of a renormalization group (RG) flow of the coupling,
and show that the RG equation is different in the cases $\gamma=0$, $\gamma =
0+$, and $\gamma >0$.
