  Many interesting combinatorial sequences, such as Ap\'ery numbers and Franel
numbers, enjoy the so-called Lucas property modulo almost all primes $p$.
Modulo prime powers $p^r$ such sequences have a more complicated behaviour
which can be described by matrix versions of the Lucas property called
$p$-linear schemes. They are examples of finite $p$-automata. In this paper we
construct such $p$-linear schemes and give upper bounds for the number of
states which, for fixed $r$, do not depend on $p$.
