Time complexity of expanding decimal to new base
Let me start with a short introduction on computation models. A (C-like) computation model specifies the inventory of operations, and the cost of each operation. Two popular computation models are the bit complexity model and the word RAM model, though the latter doesn't really have a canonical description.
In the bit complexity model, all basic operations operate on bits (except for instructions like JUMP, which we ignore here for simplicity), and they all have constant cost. The exact cost of each operation, and the exact repertoire of operations, isn't important (as long as we have a complete set of operations!), since it only affects the running time by a constant factor.
In the word RAM, we associate with each input a parameter $n$ which is a &quot;yardstick&quot; for the input. For example, a function that accepts an array of length $n$ will use the input length as a parameter (but this only works if the array entries are &quot;small&quot; – more on that later). In the word RAM, all basic operations operate on machine words. What is a machine word? It is a value which is $C\log n$ bits long, for some constant $C$ depending on the algorithm (we will see that $C$ doesn't really matter shortly). Each operation on machine words takes time $O(1)$. The operations allowed are arithmetic operations (addition, subtraction, multiplication, division with remainder), comparisons, bitwise operations (NOT, AND, OR, XOR), and shifts. Since we can simulate an operation on words of width $C\log n$ bits using $O(1)$ operations on words of width $\log n$ bits (where the constant depends on $C$), the value of $C$ doesn't really matter.
Let us now come back to the definition of $n$. We usually assume that the input consists of $Cn$ machine words of length $\log n$ bits (for some constant $C$ depending on the algorithm), for a total input length of $Cn\log n$ bits. We obtain an equivalent definition by setting $n$ to be the input length in bits, essentially since $\log(Cn\log n) = \Theta(\log n)$.
(We have not touched on the random access aspect of the RAM model, and on the uniformity aspect of both models, since these are not relevant here.)

Now back to your question. Since your array consists of numbers of length $3\log n$ bits (so we are using $n$ as our yardstick for the word RAM model), we can assume that each of them fits into a single machine word. Packing and unpacking these numbers to base $n$ is very easy:

UNPACK($m$):

$m_0 = m \bmod n$.
$m_1 = \lfloor m/n \rfloor \bmod n$.
$m_2 = \lfloor m/n^2 \rfloor$.
return $m_2,m_1,m_0$.

PACK($m_2,m_1,m_0$):

return $n^2 m_2 + n m_1 + m_0$.


You can see that both operations use $O(1)$ operations, so take $O(1)$ time in the word RAM model. With some care, the implementation can be improved to use $O(d)$ operations for numbers up to $n^d$:

UNPACK($m$):

$m_0 = m \bmod{n}$, $m = \lfloor m/n \rfloor$.
$m_1 = m \bmod{n}$, $m = \lfloor m/n \rfloor$.
$m_2 = m \bmod{n}$.
return $m_2,m_1,m_0$.

PACK($m_2,m_1,m_0$):

return $m_0 + n(m_1 + n (m_2))$.