An effective criterion for periodicity of ℓ-adic continued fractions