Transformation of virial coefficients from molar volume to pressure
We want to take this:

$$Z = \frac{PV_m}{RT} = 1 + \frac{B}{V_m} + \frac{C}{V_m^2}+…\tag{1}$$

And transform it into this:

$$Z = \frac{PV_m}{RT} = 1 + B'P+ C'P^2+…\tag{2}$$



We begin by expressing (1) in terms of $\rho_m = 1/V_m$:

$$Z=1+B\rho_m+C\rho_m^2+…\tag{3}$$

We then multiply (2) and (3) by $RT\rho_m$ to get (4) and (5), respectively. Remember that $ZRT\rho=ZRT/V_m =P$, because $Z=PV_m/RT$.

$$RT\rho_m Z = P = RT\rho_m + RT\rho_mB'P+ RT\rho_mC'P^2+…\tag{4}$$
$$RT\rho_m Z= P = RT\rho_m + RTB\rho_m^2 + RTC\rho_m^3+…\tag{5}$$

Next, we use (5) to substitute for $P$ in (4):

$$P = RT\rho_m + RT\rho_mB'(RT\rho_m + RTB\rho_m^2 + RTC\rho_m^3+…) +$$
$$ RT\rho_mC'(RT\rho_m + RTB\rho_m^2 + RTC\rho_m^3+…)^2+…\tag{6}$$

Collecting all the $\rho_m^2$ terms from (5) and (6):

$$RTB=(RTB')(RT)$$
Rearranging leads to the desired $$B'=\frac{B}{RT} \tag{7}$$

Next, collecting all the $\rho_m^3$ terms from (5) and (6):

$$RTC=(RTB')(RTB)+(RTC')(RT)^2$$

Simplifying, rearranging, and making use of (7) leads to the desired
$$C' = \frac{C-B^2}{(RT)^2}\tag{8}$$