Let
By Fermat's little theorem, . If the digit count is a multiple of , then . The cyclic decimal divisibility relation gives
and hence also modulo . Since is coprime to , every is a unit modulo . Therefore
for every . Since , this proves the required equivalence.