In this paper we obtain a simple formula for the number of matching
-ary digits of certain terms of Lucas sequences for any odd prime
. Using this formula, we present a simple sufficient condition for the sequence
to be unbounded, where
(
) are given integers and
is the
-adic valuation.