Energy required for obtaining required mass of aluminium from alumina via electrolysis
Required energy $E$ can be found as a product between voltage $U,$ current $I$ and time $t$:

$$E = UIt\label{eqn:1}\tag{1}$$

Unknown multiplier $It$ can be found using united Faraday law:

$$m = \frac{MIt}{zF}\quad\implies\quad It = \frac{mzF}{M}\label{eqn:2}\tag{2}$$

where $m$ is the mass of the substance liberated at the electrode; $M$ is the molar mass; $z$ is the number of electrons transferred per ion; $F$ is Faraday constant.
Considering aluminium is produced via Hall–Héroult process or similar, at the cathode the following reaction takes place:

$$\ce{Al^3+ + 3 e− → Al}$$

and $z = 3.$
Plugging \eqref{eqn:2} into \eqref{eqn:1} allows to finally find the energy:

$$
\begin{align}
E &amp;= \frac{mzUF}{M}\\
  &amp;= \frac{\pu{20 g} × 3 × \pu{5 V} × \pu{96485.33 C mol-1}}{\pu{26.98 g mol-1}}\\
  &amp;= \pu{1.07 MJ}\tag{3}
\end{align}
$$