For each positive integer $n$ let $a_n$ be the least positive integer multiple of $13$ such that $a_n \equiv 1 \pmod{2^n}.$ Find the number of positive integers $n$ less than or equal to $1000$ that satisfy $a_n = a_{n+1}.$
$a_n=13\cdot(13^{-1}\bmod2^n)$, and $a_n=a_{n+1}$ exactly when bit $n$ of the $2$-adic inverse of $13$ is $0$.
The binary expansion of $13^{-1}$ is eventually periodic (period $12$, since $\mathrm{ord}_{13}2=12$), and counting zero bits among positions $1,\dots,1000$ gives $501$.