The property of the solutions of Pell-Fermat equation Write
$$ 
(1+\sqrt{2})^n=a_n+b_n\sqrt{2}
$$
for $n,a_n,b_n$ are positive integers.
For each prime number $p$,
I would like to ask  if $p|b_n$ for some $n$？
Thanks.

As Old John has noted, $p$ will divide some $b_n$ for some $n \le p^2.$ This is just to note that it seems usually to happen sooner, namely at $n=p \pm 1$, or before in some cases. The primes $p=2,5$ are exceptional: $2|b_n$ when $2|n$ and $5|b_n$ when $3|n$. If we let $f(p)$ denote the least positive $n$ with $p|b_n$, the pattern seems to be that $p$ divides precisely the $b_k$ for which $f(p)|k.$ Some early values:
$$f(3)=4,\ f(7)=6,\ f(11)=12,\ f(13)=7,\ f(17)=8,\\ f(19)=20,\ f(23)=22,\ f(29)=5,\ f(31)=30.$$
It is (in all cases but $p=2,5$) so far the case that $f(p)$ is $p \pm 1$ or a divisor of one of them. It would be interesting if this could be proved, perhaps along the lines of the argument given in Old John's answer.
