A measurement of and production is presented. It is based on a data sample from Pb+Pb collisions at and pp collisions at recorded by the ATLAS detector at the LHC in 2015, corresponding to an integrated luminosity of and in Pb+Pb and pp, respectively. The measurements of per-event yields, nuclear modification factors, and non-prompt fractions are performed in the dimuon decay channel for GeV in dimuon transverse momentum, and in rapidity. Strong suppression is found in Pb+Pb collisions for both prompt and non-prompt , increasing with event centrality. The suppression of prompt is observed to be stronger than that of , while the suppression of non-prompt is equal to that of the non-prompt within uncertainties, consistent with the expectation that both arise from b-quarks propagating through the medium. Despite prompt and non-prompt arising from different mechanisms, the dependence of their nuclear modification factors on centrality is found to be quite similar.