We determine the nuclear suppression factor SPb(x), where x=MJ/ψ2/Wγp2 with MJ/ψ the J/ψ mass and Wγp the photon-nucleon energy, for the cross section of coherent J/ψ photoproduction in heavy-ion ultraperipheral collisions at the Large Hadron Collider and Relativistic Heavy Ion Collider by performing the χ2 fit to all available data on the cross section dσAA→J/ψAA/dy as a function of the J/ψ rapidity y and the photoproduction cross section σγA→J/ψA(Wγp) as a function of Wγp. We find that while the dσAA→J/ψAA/dy data alone constrain SPb(x) for x≥10−3, the combined dσAA→J/ψAA/dy and σγA→J/ψA(Wγp) data allow us to determine SPb(x) in the wide interval 10−5<x<0.05. In particular, the data favor SPb(x), which decreases with a decrease of x in the 10−4<x<0.01 interval and can be both decreasing or constant for x<10−4. Identifying SPb(x) with the ratio of the gluon distributions in Pb and the proton Rg(x,Q02)=gA(x,Q02)/[Agp(x,Q02)], we demonstrate that the leading twist approximation for nuclear shadowing provides a good description of all the data on dσAA→J/ψAA/dy and σγA→J/ψA(Wγp) as well as on the experimental values for SPb(x) derived from σγA→J/ψA(Wγp). We also show that modern nuclear parton distributions reasonably reproduce SPb(x) as well. Published by the American Physical Society 2024