Bell number
Modular arithmetic

The Bell numbers obey Touchard's congruence: If p is any prime number then

or, generalizing

Because of Touchard's congruence, the Bell numbers are periodic modulo p, for every prime number p; for instance, for p = 2, the Bell numbers repeat the pattern odd-odd-even with period three. The period of this repetition, for an arbitrary prime number p, must be a divisor of

and for all prime p ≤ 101 {\displaystyle p\leq 101} and p = 113, 163, 167 {\displaystyle p=113,163,167}, or 173 {\displaystyle 173} it is exactly this number (sequence A001039 in the OEIS).

The period of the Bell numbers to modulo n are
punctuation:no_comma, length_constraints:number_sentences[14]