The ratio of the B 0 s and B þ fragmentation fractions f s and f u is studied with B 0 s → J=ψϕ and B þ → J=ψK þ decays using data collected by the LHCb experiment in proton-proton collisions at 7, 8, and 13 TeV center-of-mass energies. The analysis is performed in bins of B-meson momentum, longitudinal momentum, transverse momentum, pseudorapidity, and rapidity. The fragmentation-fraction ratio f s =f u is observed to depend on the B-meson transverse momentum with a significance of 6.0σ. This dependency is driven by the 13 TeV sample (8.7σ), while the results for the other collision energies are not significant when considered separately. Furthermore, the results show a 4.8σ evidence for an increase of f s =f u as a function of collision energy.