  Polynomially-recursive sequences generally have a periodic behavior mod $m$.
In this paper, we analyze the period mod $m$ of a second order
polynomially-recursive sequence. The problem originally comes from an
enumeration of avoiding pattern permutations and appears to be linked with nice
number theory notions (the Carmichael function, Wieferich primes, algebraic
integers). We give the mod $a^k$ supercongruences, and generalize these results
to a class of recurrences.
