$\mathbb{Z}$-module structure of the subring generated by an algebraic number Let $a$ and $b$ be algebraic numbers which are not necessarily algebraic integers. Is there some invariant that allows us to determine whether $\mathbb Z[a]$ and $\mathbb Z[b]$ are isomorphic as $\mathbb Z$-modules?

Initial version of the question: Let $a$ be an algebraic number which is not necessarily an algebraic integer. What is the $\mathbb Z$-module structure of $\mathbb{Z}[a]$?
 A: Let $a$ be  an algebraic number, $K = \mathbb Q(a)$ the associated number field, $\mathcal O_K$ its ring of integers. Then the ring $\mathcal O_K[a]$ depends only on the set of places of $K$ at which $a$ is not integral.
$\mathcal O_K[a]$ is a good place to start for studying $\mathbb Z[a]$ because $\mathbb Z[a]$ is a finite index submodule of $\mathcal O_K[a]$. In particular, if $a \in \mathcal O_K$ then $\mathcal O_K[a]=\mathcal O_K$ is a finite free $\mathbb Z$-module, and hence $\mathbb Z[a]$ is as well, and the problem is trivial.
To say a little more about the structure of $\mathcal O_K[a]$, the key fact is that as a ring, it is $\mathcal O_K$ with some number of primes inverted. Hence as a $\mathbb Z$-module it is an extension of a sum of modules isomorphic to $\mathbb Q_p/\mathbb Z_p$ by the finite free $\mathbb Z$-module $\mathcal O_K$. Specifically, the multiplicity of $\mathbb Q_p/\mathbb Z_p$ is the total degree times ramification index of the primes lying over $p$ at which $a$ is not integral. Because $\mathbb Z[a]$ is a finite-index submodule of this, it is easy to see that it can also be expressed as a similar extension.
This should be enough information about the $\mathbb Z$-module structure for most practical purposes in number theory. However, as YCor points out, knowing the rank of $\mathcal O_K$ and the multiplicity of $\mathbb Q_p/\mathbb Z_p$ does not come close to uniquely determining $\mathcal O_K[a]$ or $\mathbb Z[a]$, except in some special cases. In particular, he raises the question of determining when $\mathbb Z[a]$ and $\mathbb Z[b]$ are isomorphic as $\mathbb Z$-modules.

Generalizing the case where $a$ is integral, there is one case where the problem simplifies considerably. Suppose there is some proper subfield $L$ of $K$ and ring extension $\mathcal O_L'$ with  $\mathcal O_L \subseteq \mathcal O_L' \subseteq \mathcal O_L$ such that $\mathcal O_K[a]= \mathcal O_L' \otimes_{\mathcal O_L} \mathcal O_K$. Then $\mathcal O_K[a]$ is a locally free module over $\mathcal O_L'$ (because $\mathcal O_K$ is a locally free module over $\mathcal O_L$) and $\mathbb Z[a]$ is a finite index submodule of $\mathcal O_K[a]$. This is only a small amount of extra data beyond $\mathcal O_L[a]$ and it seems impossible to recover much about $a$ from this data.
Thus, let us focus on the case where there does not exist such a proper subfield $L$ and ring $\mathcal O_L'$. Then, following YCor's suggestion, we can show that the ring of $\mathbb Z$-module endomorphisms of $\mathbb Z[a]$ is $\mathbb Z[a]$. In particular, this implies that (in this case) $\mathbb Z[a]$ and $\mathbb Z[b]$ are only isomorphic as $\mathbb Z$-modules if they are already isomorphic as rings.

It suffices to show that the ring of $\mathbb Z$-module endomorphisms, tensored with $\mathbb Q$, is isomorphic to $K$. This is because the ring of endomorphisms would then be commutative, hence commute with $a$, hence consist of $\mathbb Z[a]$-module endomorphisms, which are clearly only $\mathbb Z[a]$.
Since $\mathbb Q\otimes_{\mathbb Z}\operatorname{End}_{\mathbb Z} Z[a]$ contains $K$ and is contained in $M_n(\mathbb Q)$, it is a semisimple algebra, so it must be a matrix algebra of rank $r$ over a division algebra of rank $d$ over some field $L$. The field $L$ commutes with $K$ and so is contained in $K$. The minimal faithful representation of such an algebra has dimension $r d^2$ over $L$, so the index of $L$ in $K$ is at most $rd^2$, and the maximal commutative subalgebra has dimension $rd$ over $L$, so the index is at least $rd^2$. Thus $d=1$ and the index of $L$ is $r$. Hence this algebra is the full centralizer of $L$ inside $M_n(\mathbb Q)$. In particular, if $L=K$ then the endomorphism algebra must be $K$, as desired, so it suffices to handle the case when $L$ is a proper subfield. To do this, we will show that the set of places of $K$ at which $a$ is not integral is the pullback of a set of places from $L$. Because $\mathcal O_K[a]$ is isomorphic to $\mathcal O_K$ with that set of places inverted, it is isomorphic to $\mathcal O_L$, with the corresponding set of places inverted, tensored over $\mathcal O_L$ with $\mathcal O_K$, contradicting the assumption on the nonexistence of $\mathcal O_L'$.
Choose a prime $p$ over which $a$ is not integral and tensor everything with $\mathbb Z_p$. The ring  $\mathcal O_K[a] \otimes_{\mathbb Z} \mathbb Z_p$  is  isomrphic to a product of local rings at places of $\mathcal O_K$ where $a$ is integral and local fields at places of $\mathcal O_K$ where $a$ is not integral. its endomorphisms preserve the subspace of $p$-divisible elemnts, which is the product of the local fields at the $p$-divislbe places. The endomorphisms contain the centralizer of $L$, and the only way everything in the centralizer of $L$ can preserve a certain $\mathbb Q_p$-subspace is if it is the kernel of some element of $L \otimes_{\mathbb Q} \mathbb Q_p,$ i.e. a product of the local fields at the places lying over some set of places of $L$ over $p$. Hence the set of places (over $p$) of $\mathcal O_K$ at which $a$ is not integral is the inverse image of a set of places of $\mathcal O_L$, as desired.
