Problem 695: (2023 AIME II, 15)
For each positive integer $n$ let $a_n$ be the least positive integer multiple of $23$ 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=23b_n$, where $b_n$ is the inverse of $23$ mod $2^n$ in $[1,2^n]$, i.e.\ the last $n$ binary digits of the $2$-adic number $\frac1{23}$. So $a_n=a_{n+1}$ iff bit $n$ (counting from bit $0$) of $\frac1{23}$ is $0$.
- $23\cdot89=2047=2^{11}-1$, so $\frac1{23}=-89\bigl(1+2^{11}+2^{22}+\cdots\bigr)$. Writing $-89=1959-2^{11}$, this equals $1959+1958\bigl(2^{11}+2^{22}+\cdots\bigr)$. With $1958=11110100110_2$ and $1959=1958+1$, bits $1,2,3,\dots$ repeat with period $11$ as $1,1,0,0,1,0,1,1,1,1,0$: four zeros per period.
- Positions $1,\dots,990$ contain $90$ periods ($360$ zeros), and positions $991,\dots,1000$ follow $1,1,0,0,1,0,1,1,1,1$ ($3$ zeros). Total $363$.
- The answer is $\boxed{363}$.
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}.$