Fixpoint maxDiv (v : Z) (p : nat) {struct p} : nat :=
  match p with
  | O => 0
  | S p' =>
      match ZdividesP v (Zpower_nat radix p) with
      | left _ => p
      | right _ => maxDiv v p'
      end
  end.

Theorem maxDivUniqueDigit : forall v : Z, v <> 0 -> Zdivides v (Zpower_nat radix (maxDiv v (digit radix v))) /\ ~ Zdivides v (Zpower_nat radix (S (maxDiv v (digit radix v)))).