I have a question regarding an algorithm for finding the ring of algebraic integers $\mathfrak{O}_K$ in an algebraic number field $K$. The algorithm that I have been using is as follows:
1) Take a $\Bbb{Q}$-basis $w = \{ w_1, ..., w_n\}$ with $w \subset \mathfrak{O}_K$. Let $M$ be the $\Bbb{Z}$ span of $w$, so $M \subset \mathfrak{O}_K$.
Calculate $\Delta[M]^2=\Delta[w_1, ..., w_n]^2$ - the usual discriminant.
2) If $\;[\mathfrak{O}_K:M]=m\quad$then $\quad|\Delta(M)^2| = m^2|\Delta(\mathfrak{O}_K)^2|$
If $|\Delta(M)^2|$ is squarefree then we know that $m=1$ and $w$ is a $\Bbb{Z}$ basis for $\mathfrak{O}_K$
Otherwise we check for each prime $p$ with $p^2$ dividing $|\Delta(M)^2|\;$ we look for $\alpha\in\mathfrak{O}_K$ of the form $\alpha = \frac1p\sum_jc_jw_j$ where $c_j\in\Bbb{Z}$ not all divisible by p. We can multiply through by an integer to make the $c_k$ which is not divisible by $p$ by 1. Clearly only need to check co-efficients $0\le c_j \lt p$.
If we find such an $\alpha$ with $c_k$ not equal to zero, we replace $w_k$ with our $\alpha$ to get another $\Bbb{Q}$-basis, $M'$ and our discriminant is divided by $p$.
3) We repeat with our new basis $M'$. If such an $\alpha$ doesn't exist then $p$ doesn't divide $\;[\mathfrak{O}_K:M]=m\quad$ -we use a theorem of Cauchy on finite groups here I believe.
My question is as follows, if we check a prime $p_1$ for basis $M$ and we find no such $\alpha$ of the form $\alpha = \frac{1}{p_1}\sum_jc_jw_j$ where $c_j\in\Bbb{Z}$ not all divisible by $p_1$, -so we move to the next prime $p_2$ with $p_2^2$ dividing $|\Delta(M)^2|\;$; if we find such an $\alpha$ and get a new basis $M'$, do we have to re-check all the possible $\alpha$'s for prime $p_1$ in our new basis $M'$ again??
Thanks