  Let $P,Q\in\Bbb Z$, $U_0=0,\ U_1=1$ and $U_{n+1}=PU_n-QU_{n+1}$. In this
paper we obtain a general congruence for $U_{kmn^r}/U_k\pmod {n^{r+1}}$, where
$k,m,n,r$ are positive integers. As applications we extend Lucas' law of
repetition and characterize the square prime factors of $a^n+1$ or $S_n$, where
$\{S_n\}$ is given by $S_1=P^2+2$ and $S_{k+1}=S_k^2-2\ (k\ge 1)$.
