Compressibility Factor Of Gases
Both quantities are of the real gas.

Note that for the ideal gas behaviour, the compressibility factor $$Z=\frac{V_\text{real}}{V_\text{ideal}}=\frac{pV_\text{real}}{nRT}=1$$
 for any combination of $p, V, T$.

But real gases, in contrary to the ideal gas, have nonzero volume of molecules and there are intermolecular interactions.

The volume of molecules increases $Z$, as it makes the pressure higher, because the collision frequency is higher.

The cohesive forces between molecules decreases  $Z$. As molecule attraction, like hydrogen bonds or dipole interactions, decreases the effective number of molecules and therefore pressure.

This is reflected in the van der Waals equation - probably the simplest state equation of real gases, for not too high pressure: 
$$\begin{align}
\left(p + \frac{an^2}{V^2}\right)\left(V - nb\right)&amp;=nRT \\
\left(p + \frac{a}{V_\mathrm m^2}\right)\left(V_\mathrm m - b\right)&amp;=RT
\end{align}$$

$$\begin{align}
Z &amp;= \frac{p\cdot V_\text{real}}{nRT} \\
Z&amp;=  \frac{p\cdot V_\text{real}}{\left(p + \frac{an^2}{V_\text{real}^2}\right)(V_\text{real} - nb)} \\
Z&amp;=  \frac{1}{\left(1 + \frac{an^2}{p \cdot V_\text{real}^2}\right)\left(1 - \frac{nb}{V_\text{real}}\right)} \\
Z&amp;=  \frac{1}{\left(1 + \frac{a}{pV_{\mathrm m,\text{real}}^2}\right)\left(1 - \frac{b}{V_{\mathrm m,\text{real}}}\right)}
\end{align}$$

For $|x|\ll1, 1/(1+x)=1-x$

For not too far from ideal behaviour, we can apply the above approximation.

$$\begin{align}
Z&amp;=\left(1 - \frac{an^2}{pV_{\mathrm{real}}^2}\right)\left(1 + \frac{bn}{V_{\mathrm{real}}}\right) \\
Z&amp;=\left(1 - \frac{a}{pV_{\mathrm m,\text{real}}^2}\right)\left(1 + \frac{b}{V_{\mathrm m,\text{real}}}\right) \\
\end{align}$$

We can therefore also afford to neglect minor terms.

$$\begin{align}
Z&amp;=1 - \frac{an^2}{pV_{\mathrm{real}}^2}+ \frac{bn}{V_{\mathrm{real}}}\\
Z&amp;=1 - \frac{a}{pV_{\mathrm m,\text{real}}^2}+ \frac{b}{V_{\mathrm m,\text{real}}}\\
\end{align}$$

To address clarified scenario, as a the same amounts of the ideal and real gas
are under the same temperature and pressure:

$$V_\text{ideal gas}=\frac{nRT}{p}$$
$$V_\text{real gas}=Z \frac{nRT}{p}$$

There is need to perform iteration for probably the easiest way to get the result. 
With the $V_{\rm{ideal gas}}\ $ as the first approximation. The other option is to solve the root of the cubic equation what we probably do not want to.

$$\begin{align}
V_\text{real}&amp;=Z(p, V_\text{real})\frac{nRT}{p}\\
V_\text{real}&amp;=\frac{1}{\left(1 + \frac{an^2}{p \cdot V_\text{real}^2}\right)\left(1 - \frac{nb}{V_\text{real}}\right)} \frac{nRT}{p} \\
V_\text{real}&amp;=\left( 1 - \frac{an^2}{pV_{\rm{real}}^2}+ \frac{bn}{V_{\rm{real}}}\right) \frac{nRT}{p} \\
\end{align}$$

The van der Waals equation can also be expressed in terms of reduced
properties

$$\left( P_r + \frac{3}{V_\rm{r}^2}\right) \left( V_{\rm r}-\frac{1}{3}\right) = \frac{8}{3}T_\mathrm r$$

This yields a critical compressibility factor $3/8$.

The values of pressure, temperature and volume are divided by the
respective critical values of the given gas.