1 Introduction

The Bell numbers \(B_n\) represent number of partitions of a given set of n elements and are one of the most classical objects in combinatorics. The r-Bell numbers \(B_{n,r}\) extend this definition and count partitions of a set of \(n+r\) elements such that r chosen elements are separated [13]. They appear also naturally when dealing with congruences of classical Bell numbers, which will be shown in the sequel. If we restrict the partitions to consist of exactly \(k+r\) sets, their number is given by the r-Stirling numbers of the second kind \(\left\{ \begin{array}{c} n \\ k \end{array}\right\} _{r}\) (see [2,3,4]), which lets us write \(B_{n,r}=\sum _{k=0}^n\left\{ \begin{array}{c} n \\ k \end{array}\right\} _{r}\). The framework of this paper is slightly more general. Precisely, we focus on the r-Bell polynomials given by

Clearly, we have \(B_{n,r}(1)=B_{n,r}\). Furthermore, for \(r=0\) we obtain the Bell polynomials, known also as Touchard or exponential polynomials. Some of the most intensively studied features of these polynomials are their divisibility properties (see, among others, [7, 8, 10, 12, 15, 19,20,21,22]). The goal of the paper is to find precise identities that directly lead to some known as well as some new congruences. This method is not only more constructive and informative, but also, at least in this case, turns out to be significantly shorter.

The history of research on congruences for Bell number is very long and goes back to 1933 and the famous Touchard congruence [21]

$$\begin{aligned} B_{n+p}\equiv B_n+B_{n+1}\ \ \ \ \ (\text{ mod } p), \end{aligned}$$

valid for any natural n and prime p. More recently, Sun and Zagier [19] showed that

$$\begin{aligned} (-x)^m\sum _{k=1}^{p-1} \frac{B_{k,0}(x)}{(-m)^k}\equiv -x^pD_{m-1}(1-x), \ \ \ \ \ \ \ \ \ (\text{ mod } p\mathbb {Z}_p[x]), \end{aligned}$$
(1)

where \(\mathbb {Z}_p\) denotes the ring of p-adic integers and \(D_n(x)\) is the derangement polynomial defined by

$$\begin{aligned} D_n(x)=\sum _{k=0}^n{n \atopwithdelims ()k}k!(x-1)^{n-k}. \end{aligned}$$

In particular, \(D_n(0)=D_n\) is the n-th derangement number. The especially interesting property of (1) is that besides the term \(x^p\) the right-hand side does not depend on p, which had been earlier conjectured by the first author of [19] in the case \(x=1\). Later on, this result has been generalized in several directions. In [20] and [15] the authors considered \(B_{n+k}\) and \(B_{k,r}\), respectively, instead of \(B_k\) on the left-hand side of the congruence, while in [18] the sum in (1) is considered up to \(p^a-1\), where a is any positive integer. In this paper, we unify all those results by providing the following equivalence (see Theorem 2)

$$\begin{aligned} (-x)^{m+r}\sum _{i=1}^{p^a-1}\frac{B_{n+i,r}(x)}{(-m)^i}\equiv \left( \sum _{l=1}^ax^{p^l}\right) \sum _{k=0}^n\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r(-1)^{k+1}&D_{k+m+r-1}(1-x)\\&\ \ \ \ \ \ \ \ (\text{ mod }\ p\mathbb {Z}_p [x]). \end{aligned}$$

In particular, for \(x=1\) we obtain

$$\begin{aligned} \sum _{i=1}^{p^a-1}\frac{B_{n+i,r}}{(-m)^i}\equiv a\sum _{k=0}^n\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r(-1)^{k+m+r-1}D_{k+m+r-1}\ \ \ \ \ (\text{ mod }\ p\mathbb {Z}_p [x]). \end{aligned}$$

As a by-product we prove also another interesting congruences (see Theorem 1):

$$\begin{aligned} (-x)^r\left( B_{p^a-1,r}(x)-1\right)&\equiv \left( \sum _{l=1}^ax^{p^l-p}\right) D_{p+r-1}(1-x)\\&\equiv -\left( \sum _{l=1}^ax^{p^l}\right) D_{r-1}(1-x)\ \ \ \ \ \ \ (\text{ mod } p\mathbb {Z}[x]), \end{aligned}$$

where \(r\ge 1\). The first one holds for \(r=0\) as well and this special case has been already known for \(a=1\) [19].

Nevertheless, we would like to turn the Reader’s attention to the methods employed. Precisely, we derive exact identities that immediately imply the congruences. This brings in much more information and explains somehow the nature of the congruences. Furthermore, such approach is very effective which makes the proofs surprisingly short and easily accessible. Note also that a similar conception has already appeared in [16], where the author recovered (1) for \(x=1\). In order to explain the basic idea let us observe that by the simple congruence \({p-1\atopwithdelims ()k} \equiv (-1)^k\ (\text{ mod } p)\), valid for any prime p and any integer \(0\le k \le p-1\), and by Fermat’s little theorem, the sum on the left-hand side of (1) for \(a=1\) is equivalent to

$$\begin{aligned} \sum _{i=1}^{p-1}{p-1\atopwithdelims ()k}{B_{k}(x)}m^{p-1-k}=B_{p-1,m}(x). \end{aligned}$$

Then, it is enough to focus on the polynomials \(B_{p-1,m}(x)\). In fact, we find their representation by means of derangement polynomials for p being not only a prime number. Additionally, this relation is a motivation to study the r-Bell polynomials even if one is interested only in classical Bell polynomials.

2 Preliminaries

2.1 r-Bell polynomials

We define the r-Stirling number of the second kind \(\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r\) as the number of partitions of the set \(\{ 1, 2, \ldots , n+r\}\) into \(k+r\) non-empty disjoint subsets, such that the numbers \(1, 2 ,\ldots , r\) are in distinct subsets. They were introduced and described in details by A. Z. Broder in [2] (see also [3, 4]). Another way to define them is the expansion

$$\begin{aligned} (x+r)^n=\sum _{k=0}^n\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r x^{\underline{k}}, \end{aligned}$$

where \(x^{\underline{k}}=x(x-1)\cdot ...\cdot (x-k+1)\) is the falling factorial. In fact, following the notation from [2] we should write \(\left\{ \begin{array}{c} n+r \\ k+r \end{array}\right\} _r\) instead of \(\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r\), but this seems more complicated and incompatible with other notation as, for example, the notation of r-Bell numbers. The convention we propose has already appeared in [15], and an analogous one was used in [3, 4]. The r-Stirling numbers satisfy the recurrence

$$\begin{aligned} \left\{ \begin{array}{c} n \\ k \end{array}\right\} _r=(k+r)\left\{ \begin{array}{c} n-1 \\ k \end{array}\right\} _r+\left\{ \begin{array}{c} n-1 \\ k-1 \end{array}\right\} _r, \end{aligned}$$

and are expressed by the elementary sum

$$\begin{aligned} \left\{ \begin{array}{c} n \\ k \end{array}\right\} _r=\sum _{i=0}^k\frac{(i+r)^n(-1)^{k-i}}{i!(k-i)!}. \end{aligned}$$
(2)

The r-Bell polynomial \(B_{n,r}(x)\) is given by

$$\begin{aligned} B_{n,r}(x)=\sum _{i=0}^n\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r x^i. \end{aligned}$$

Its exponential generating function takes the form

$$\begin{aligned} {\mathcal {B}}_r(t,x)=\sum _{n=0}^\infty B_n(x)\frac{t^n}{n!}=e^{x(e^t-1)+rt}. \end{aligned}$$

Thus, we have \(B_{n,r}(x)=\frac{d^n}{dt^n}\mathcal B_r(t,x)\Big |_{t=0}\) and the general Leibniz rule gives us

$$\begin{aligned} \sum _{k=0}^{n}{n \atopwithdelims ()k}B_{k,r}(x) \,m^{n-k}=B_{n,r+m}(x). \end{aligned}$$
(3)

Using the recurrence for r-Stirling numbers one can easily verify that

$$\begin{aligned} \frac{d^m}{dt^m}{\mathcal {B}}_r(t,x)=\sum _{k=0}^m\left\{ \begin{array}{c} m \\ k \end{array}\right\} _r x^ke^{e^x-1+(k+r)x}=\sum _{k=0}^m\left\{ \begin{array}{c} m \\ k \end{array}\right\} _r x^k{\mathcal {B}}_{k+r}(t,x). \end{aligned}$$

Consequently, calculating the n-th derivative of both sides at \(t=0\), we get

$$\begin{aligned} B_{n+m,r}(x)=\sum _{k=0}^m\left\{ \begin{array}{c} m \\ k \end{array}\right\} _r x^{k}B_{n,k+r}(x). \end{aligned}$$
(4)

See [3] eq. (3.22–3.23) for the case \(x=0\). Applying additionally the formula (3), we arrive at so called Spivey formula for r-Bell polynomials. This simple proof seems to be new, even in the classical case \(r=0\) (cf. [1, 9, 11, 14, 17, 23]).

2.2 Derangement polynomials

Derangement polynomials \(D_n(x)\), \(n\ge 0\), also called x-factorials of n (see [6] for some details), are defined by the formula

$$\begin{aligned} D_n(x)=\sum _{k=0}^n{n\atopwithdelims ()k}k!(x-1)^{n-k}. \end{aligned}$$

For \(x=0\) they reduce to the standard derangement numbers \(D_n=D_n(0)\). From the definition and by the binomial inverse we get

$$\begin{aligned} \sum _{k=0}^n{n\atopwithdelims ()k}(1-x)^{k}D_{n-k}(x)=n!. \end{aligned}$$
(5)

The following recurrence relation holds

$$\begin{aligned} D_n(x)=nD_{n-1}(x)+(x-1)^n, \end{aligned}$$

from which one may conclude the formula for exponential generating function:

$$\begin{aligned} {\mathcal {D}}(t,x)=\sum _{k=0}^\infty \frac{D_k(x)}{k!}t^n=\frac{e^{(x-1)t}}{1-t}. \end{aligned}$$
(6)

3 Results

It is known that for any natural numbers nm we have \(D_{n+m}(x)\equiv (x-1)^mD_n(x)\ (\text{ mod }\ n)\). Below, we present precise recurrence formula that directly implies this congruence.

Proposition 1

For \(m,n\ge 0\) we have

$$\begin{aligned}&D_{n+m}(x)-(x-1)^mD_n(x)\\&=m\sum _{k=0}^{m-1}\sum _{i=0}^n{m-1\atopwithdelims ()k}{n\atopwithdelims ()i}{(k+i)!}(x-1)^{m-1-k}D_{n-i}(x). \end{aligned}$$

Proof

Using the exponential generating function (6) of derangement polynomials we may write

$$\begin{aligned} D_{n+m}(x)&=\frac{d^{n+m}}{dt^{n+m}}{\mathcal {D}}(t,x)=\frac{d^n}{dt^n}\frac{d^m}{dt^m}\frac{e^{(x-1)t}}{1-t}\Bigg |_{t=0}\\&=\frac{d^n}{dt^n}\sum _{k=0}^m{m\atopwithdelims ()k}(x-1)^{m-k}e^{(x-1)t}\frac{k!}{(1-t)^{k+1}}\Bigg |_{t=0}\\&=\sum _{k=0}^m{m\atopwithdelims ()k}k!(x-1)^{m-k}\frac{d^n}{dt^n}\left( {\mathcal {D}}(t,x)\frac{1}{(1-t)^{k}}\right) \Bigg |_{t=0}. \end{aligned}$$

Considering the term corresponding to \(k=0\) separately, we get

$$\begin{aligned}&D_{n+m}(x)\\&\quad =(x-1)^mD_n(x)+\sum _{k=1}^m{m\atopwithdelims ()k}k!(x-1)^{m-k}\sum _{i=0}^n{n\atopwithdelims ()i}D_{n-i}(x)\frac{(k+i-1)!}{(k-1)!}\\&\quad =(x-1)^mD_n(x)+m\sum _{k=0}^{m-1}\sum _{i=0}^n{m-1\atopwithdelims ()k}{n\atopwithdelims ()i}{(k+i)!}(x-1)^{m-1-k}D_{n-i}(x), \end{aligned}$$

as required. \(\square \)

In the next proposition we provide a representation of r-Bell polynomials by means of derangement polynomials. Despite of its simple form, the author has not found it in the literature. See (9) in [5] for a similar equivalence, which is additionally restricted to \(x=1\),

Proposition 2

For any \(n,\ge 0\) we have

$$\begin{aligned} n!B_{n,r}(x)=\sum _{i=0}^n (i+r)^nx^i{n \atopwithdelims ()i}D_{n-i}(x). \end{aligned}$$

Proof

From (2) we have

$$\begin{aligned} B_{n,r}(x)&=\sum _{k=0}^n {x^k}\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r=\sum _{k=0}^n {x^k}\sum _{i=0}^k\frac{(i+r)^n(-1)^{k-i}}{i!(k-i)!}\\&=\sum _{i=0}^n \frac{(i+r)^n}{i!}\sum _{k=i}^n\frac{x^k}{(k-i)!}(-1)^{k-i}=\sum _{i=0}^n \frac{(i+r)^n}{i!}\sum _{k=0}^{n-i}\frac{x^{k+i}}{k!}(-1)^{k}\\&=\frac{1}{n!}\sum _{i=0}^n (i+r)^nx^i{n \atopwithdelims ()i}D_{n-i}(1-x). \end{aligned}$$

\(\square \)

We will see that this identity immediately yields congruence relations between r-Bell and derangement polynomials. First, let us note that it was shown in [19] (formally, it was done only for \(x=1\), but justification works for any \(x\in \mathbb {R}\)) that (1) follows

$$\begin{aligned} B_{p-1}(x)\equiv D_{p-1}(1-x)+1\ \ \ \ \ \ \ (\text{ mod } p\mathbb {Z}[x]). \end{aligned}$$
(7)

We extend this congruence into r-Bell polynomials, while considering \(p^a\) instead of p in the indices. In particular, taking \(r=0\) and \(a=1\), it gives a new, straightforward proof of (7).

Theorem 1

For any prime p and non-negative intigers \(a,r\ge 0\) we have

$$\begin{aligned} (-x)^r\left( B_{p^a-1,r}(x)-1\right) \equiv \left( \sum _{l=1}^ax^{p^l-p}\right) D_{p+r-1}(1-x)\ \ \ \ \ \ \ (\text{ mod } p\mathbb {Z}[x]). \end{aligned}$$

If, additionally, \(r\ge 1\), it holds

$$\begin{aligned} (-x)^r\left( B_{p^a-1,r}(x)-1\right) \equiv -\left( \sum _{l=1}^ax^{p^l}\right) D_{r-1}(1-x)\ \ \ \ \ \ \ (\text{ mod } p\mathbb {Z}[x]). \end{aligned}$$

Proof

It is enough to prove the first congruence, as the other one follows by Proposition 1.

We start with considering the case \(a=1\). Due to (3) and Proposition 1 we may narrow our attention to \(0\le r\le p-1\). From Wilson’s theorem, Proposition 2 and Fermat’s little theorem we have

$$\begin{aligned} B_{p-1,r}(x)&\equiv -(p-1)!B_{p-1,r}(x)\\&\equiv -\sum _{i=0}^{p-1} (i+r)^{p-1}x^i{p-1 \atopwithdelims ()i}D_{p-1-i}(1-x)\\&\equiv -\sum _{\begin{array}{c} 0\le i \le p-1\\ p\,\not \mid \, (i+r) \end{array}}x^i{p-1 \atopwithdelims ()i}D_{p-1-i}(1-x)\ \ \ \ \ \ \ (\text{ mod } p\mathbb {Z}[x]). \end{aligned}$$

For \(r=0\), the excluded index in the last sum is \(i=0\), while for \(r\ge 1\) it is \(i=p-r\). Hence, by (5) and Proposition 1 we get for \(r\ge 1\)

$$\begin{aligned} (-x)^rB_{p-1,r}(x)&\equiv (-x)^r\left( -(p-1)!+x^{p-r}{p-1\atopwithdelims ()p-r}D_{r-1}(1-x)\right) \\&\equiv (-x)^r+(-x)^pD_{r-1}(1-x)\\&\equiv (-x)^r+D_{p+r-1}(1-x)\ \ \ \ \ \ \ (\text{ mod } p\mathbb {Z}[x]), \end{aligned}$$

as required. For \(r=0\) we proceed analogously, or just refer to (7).

What has left is to extend the result into all \(a\ge 0\). For this purpose, we employ the congruence ([15], Theorem 5)

$$\begin{aligned} B_{n+p^m,r}(x)\equiv B_{n+1,r}(x)+\left( \sum _{l=1}^mx^{p^l}\right) B_{n,r}(x)\ \ \ \ \ \ \ (\text{ mod } p\mathbb {Z}[x]), \end{aligned}$$
(8)

where \(n,m\ge 0\). Namely, applying it several times, and using the equality \(B_{0,r}(x)=1\), we get

$$\begin{aligned} x^{p}\left( B_{p^a-1,r}(x)-1\right)&\equiv B_{p^a-1+p,r}(x)-B_{p^a,r}(x)-x^p\\&\equiv \left( \sum _{l=1}^ax^{p^l}\right) \big (B_{p-1,r}(x)-1\big )+B_{p,r}(x)-B_{1,r}(x)-x^p\\&\equiv \left( \sum _{l=1}^ax^{p^l}\right) \left( B_{p-1,r}(x)-1\right) , \end{aligned}$$

which ends the proof. \(\square \)

Fixing \(x=1\) in the above theorem, we obtain the following congruences bonding r-Bell and derangement numbers

Corollary 1

For any prime p and \(a,r\ge 0\) we have

$$\begin{aligned} B_{p^a-1,r}\equiv a(-1)^rD_{p+r-1}+1\ \ \ \ (\text{ mod }\ p). \end{aligned}$$

If, additionally, \(r\ge 1\), it holds

$$\begin{aligned} B_{p^a-1,r}\equiv a(-1)^{r-1}D_{r-1}+1\ \ \ \ (\text{ mod }\ p). \end{aligned}$$

Now we will give a simple argument recovering and generalizing Theorem 6 from [15], Theorem 1.1 from [18] and, as a special case, the congruence (1). First, let us rewrite (3) into the form

$$\begin{aligned} \sum _{k=1}^{p^a-1}{p^a-1 \atopwithdelims ()k}B_{k,r}(x) \,m^{p^a-1-k}=B_{p^a-1,r+m}(x)-m^{p^a-1}, \end{aligned}$$

where we just separated the term for \(k=0\). Since \({p^a-1 \atopwithdelims ()k}\equiv (-1)^k\) and \(m^{p^a-1}\equiv 1\) \((\text{ mod }\ p)\) for \(0\le k \le p-1 \) and \(p\not \mid m\), see Lemma 2.1 in [18] and the Fermat–Euler theorem, respectively, and using the latter congruence form Theorem 1, we obtain

Corollary 2

For any integers \(a,m\ge 1\) and any prime number \(p\not \mid m\), we have

$$\begin{aligned} (-x)^{m+r}\sum _{k=1}^{p^a-1}\frac{B_{k,r}(x)}{(-m)^k}\equiv -\left( \sum _{l=1}^ax^{p^l}\right) D_{m+r-1}(1-x)\ \ \ \ \ (\text{ mod } p\mathbb {Z}_p [x]), \end{aligned}$$

where \(\mathbb {Z}_p\) denotes the ring of p-adic integers.

As a final step, we will generalize the above congruence by replacing \(B_{k,r}\) with \(B_{n+k,r}\) for a natural number n. Precisely, by virtue of (4), we get

$$\begin{aligned}&\sum _{i=1}^{p^a-1}{p^a-1 \atopwithdelims ()i}B_{n+i,r} \,m^{p^a-1-i}\\&\quad =\sum _{i=1}^{p^a-1}{p^a-1 \atopwithdelims ()i}\left( \sum _{k=0}^n\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r x^{k}B_{i,k+r}(x)\right) m^{p^a-1-i}\\&\quad =\sum _{k=0}^n\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r x^{k}\sum _{i=1}^{p^a-1}{p^a-1 \atopwithdelims ()i}B_{i,k+r}(x)m^{p^a-1-i} , \end{aligned}$$

and consequently

$$\begin{aligned}\nonumber \sum _{i=1}^{p^a-1}\frac{B_{n+i,r}}{(-m)^i} \equiv \sum _{k=0}^n\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r x^{k}\sum _{i=1}^{p^a-1}\frac{B_{i,k+r}(x)}{(-m)^{i}}\ \ \ \ \ (\text{ mod } p\mathbb {Z}_p [x]) . \end{aligned}$$

One can identify the inner sum as the one from Corollary 2, which leads to

Theorem 2

For any integers \(a, m\ge 1\), \(n\ge 0\) and any prime number \(p\not \mid m\), we have

$$\begin{aligned}(-x)^{m+r}\sum _{i=1}^{p^a-1}\frac{B_{n+i,r}(x)}{(-m)^i}\equiv \left( \sum _{l=1}^ax^{p^l}\right) \sum _{k=0}^n\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r(-1)^{k+1}&D_{k+m+r-1}(1-x)\\&\ \ \ \ \ \ \ \ (\text{ mod }\ p\mathbb {Z}_p [x]). \end{aligned}$$

where \(\mathbb {Z}_p\) denotes the ring of p-adic integers.

Note that taking \(r=0, a=1\) or \(n=0,a=1\) we recover the main result of [20] and Theorem 6 from [15], respectively. On the other hand, for \(n=r=0\), we obtain the main result of [18].

For \(x=1\) the above-given theorem reduces to

Corollary 3

For any integers \(a,m\ge 1\), \(n\ge 0\) and any prime number \(p\not \mid m\), we have

$$\begin{aligned} \sum _{k=1}^{p^a-1}\frac{B_{n+k,r}}{(-m)^k}\equiv a(-1)^{m+r}\sum _{k=0}^n\left\{ \begin{array}{c} n \\ k \end{array}\right\} _r(-1)^{k+1}D_{k+m+r-1}\ \ \ \ \ (\text{ mod } p\mathbb {Z}_p). \end{aligned}$$