Each account is simply another subaddress. Therefore the math is identical to the usual subaddresses calculation - it is still represented by an
i index in:
PSi = Hs(pV0 || i) G + PS0
(using Mastering Monero's notation).
However, it's worth noting that the calculation for the subaddress secret key is actually
m = Hs(a || index_major || index_minor), and for its public key,
M = mG, where
index_major is the account index and
index_minor is the subaddress index. Thus i is the concatenation of
index_major || index_minor.
Therefore the Master Monero example is a little misleading. The subaddress, regardless of which account it is in, is actually calculated like:
PSij = Hs(pV0 || j || i) G + PS0
Or in the common notation used in the code and elsewhere:
m = Hs(a || index_major || index_minor)
M = mG
D = M + B
D being your public view and spend keys for account # subaddress #.
Sources: device_default.cpp#L144 and device_default.cpp#L198