1 Introduction

We let \(\mathbb {N}\) denote the set of non-negative integers, \(\mathbb {N}_{+}\) the set of positive integers, \({\mathbb {P}}\) the set of prime numbers and finally we write \(\mathbb {N}_{\ge k}\) for the set \(\{n\in \mathbb {N}:n\ge k\}\). In the sequel we will also need the notion of the p-adic valuation of an integer, where \(p\in {\mathbb {P}}\) is fixed. More precisely, if \(n\in \mathbb {Z}\) then the number

$$\begin{aligned} \nu _{p}(n):={\text {max}}\{k\in \mathbb {N}:p^{k}\mid n\} \end{aligned}$$

is called the p-adic valuation of n. We also adopt the standard convention that \(\nu _{p}(0)=+\infty \). From the definition we easily deduce that for each \(n_{1}, n_{2}\in \mathbb {Z}\) the following properties hold:

$$\begin{aligned} \nu _{p}(n_{1}n_{2})=\nu _{p}(n_{1})+\nu _{p}(n_{2})\quad \text{ and }\quad \nu _{p}(n_{1}+n_{2})\ge {\text {min}}\{\nu _{p}(n_{1}),\nu _{p}(n_{2})\}. \end{aligned}$$

If \(\nu _{p}(n_{1})\ne \nu _{p}(n_{2})\), then the inequality can be replaced by equality. Moreover, one can easily extend the notion of p-adic valuation to rational numbers \(x=a/b, b\ne 0\), in the following way: \(\nu _{p}(x)=\nu _{p}(a)-\nu _{p}(b)\).

Let \(d\in \mathbb {N}_{\ge 2}\), \(n\in \mathbb {N}\) and consider the number \(H_{d}(n)\) of those \(\sigma \in S_{n}\) which are products of pairwise disjoint cycles of length d. As usual, the identity permutation is also counted as a product of 0 cycles of length d. In particular, if \(d=p\in {\mathbb {P}}\) is a prime number, then \(H_p(n)\) counts the number of solutions in \(S_{n}\) of the equation \(\sigma ^{p}=id\).

In the paper [1] the authors initiated the study of arithmetic properties of the sequence \((H_{d}(n))_{n\in \mathbb {N}}\) for \(d=2\). In this case, the number \(H_{2}(n)\) is the number of involutions in the group \(S_{n}\). In particular, they obtained several combinatorial identities, presented description of the 2-adic valuation of \(H_{2}(n)\) and gave precise information about the rates of growth of \(H_2(n)\). The mentioned paper can be seen as a complement of case \(p=2\) of the papers [5,6,7, 10] concerning p-adic valuations of numbers \(H_p(n)\), where p is a prime number. The study of the sequence \((H_{p}(n))_{n\in \mathbb {N}}\) with p-prime, is quite natural because the number \(H_{p}(n)\) counts the elements of order p in the group \(S_{n}\). However, it seems that there are no results concerning the general sequence \((H_{d}(n))_{n\in \mathbb {N}}\), where \(d\in \mathbb {N}_{\ge 2}\) is not necessarily a prime. In particular, it should be stressed that there is no results on p-adic valuations of numbers \(H_d(n)\), where p is a prime number greater than d (even in the case when d is a prime). Our first aim is to fill this gap and present broad spectrum of results concerning various arithmetic properties of the sequence \((H_d(n))_{n\in \mathbb {N}}\) and also some families of polynomials related to them.

Let us introduce the content of the paper.

Section 2 is devoted to basic properties of the general sequence \((H_{d}(n))_{n\in \mathbb {N}}\). In particular, we recall the standard recurrence relation and closed formula for our sequence. Moreover, we present the expression for the exponential generating function

$$\begin{aligned} \mathcal {H}_d(x)=\sum _{n=0}^{\infty }\frac{H_{d}(n)}{n!}x^n. \end{aligned}$$

With the help of the function \(\mathcal {H}_{d}(x)\) we obtain several interesting identities involving elements of our sequence and related sequences (such as roots of unity or Bernoulli numbers).

In Sect. 3 we study periodicity properties of the sequences of remainders of numbers \(H_d(n)\) modulo a given positive integer c. We start with the results for \(c\in \{d+1,d+2\}\). We continue the work with the case of c being of the form \(d+k\), where k is a fixed positive integer. Next we show that if c is a power of a prime number not equal to d, then c is a period of the sequence \((H_d(n)\pmod {c})_{n\in \mathbb {N}}\). At the end of the section, the result for composite d and arbitrary c or for c co-prime to d is given.

Section 4 begins with a revision of a lower estimate of the p-adic valuation of the number \(H_p(n)\):

$$\begin{aligned} \nu _p(H_p(kp^2+jp+i))\ge k(p-1)+j,\quad k\in \mathbb {N}, i,j\in \{0,\ldots ,p-1\}, \end{aligned}$$

where the prime number p is fixed. We give a new proof of this known fact in order to obtain some results on periodicity of sequences \(\left( \frac{H_p(n)}{p^{\beta _n}}\pmod {p^r}\right) _{n\in \mathbb {N}}\), where \(r\in \mathbb {N}_+\) and \(\beta _n\) is mentioned lower bound of \(\nu _p(H_p(n))\) or \(\beta _n=\nu _p(H_p(n))\). Moreover, we show that for each prime number p and \(j\in \{0,\ldots ,p-1\}\) there exists a \(b_j\in \{0,\ldots ,p-1\}\) such that \(H_p(kp^2+jp+b_j)=k(p-1)+j\) for any \(k\in \mathbb {N}\). These results can be seen as a complement of the series of papers [5,6,7, 10].

In Sect. 5 we describe the p-adic valuations of the numbers \(H_d(n)\), where \(p>d\). In order to do this, we show that the sequence \((H_d(n))_{n\in \mathbb {N}}\) is a restriction of a differentiable function \(f_d:\mathbb {Z}_p\rightarrow \mathbb {Z}_p\), where \(\mathbb {Z}_p\) is a ring of p-adic integers. Then, we prove that there exists a function \(g_d:\mathbb {Z}_p\times p\mathbb {Z}_p\rightarrow \mathbb {Q}_p\) such that for any \(x\in \mathbb {Z}_p\) and \(h\in p\mathbb {Z}_p\) we have

$$\begin{aligned} f_d(x+h)=f_d(x)+hf'_d(x)+h^2g_d(x,h) \end{aligned}$$

and \(g_d(x,h)\in \mathbb {Z}_p\) if \(d\ge 3\) or \(p\mid f_2(x)\). At last, we obtain a qualitative description of the sequence \((\nu _p(H_d(n)))_{n\in \mathbb {N}}\) using Hensel’s lemma.

Section 6 is devoted to study of a family of polynomials \(W_{d,m}(x)\) which are closely related to m-th derivative of the generating function \(\mathcal {H}_{d}(x)\). More precisely, we have \(\mathcal {H}^{(m)}_d(x)=W_{d,m}(x)\mathcal {H}_d(x)\). We show that \(W_{d,m}(x)\) is a monic polynomial with integral coefficients and we give a formula for its coefficients in case of odd d. These coefficients are expressed in terms of (shifted) elements of the sequence \((H_{d}(n))_{n\in \mathbb {N}}\). Next, we compute the exponential generating function \(\mathcal {W}_d(x,t)\) of the sequence \((W_{d,m}(x))_{m\in \mathbb {N}}\) and prove identities and congruences involving these polynomials. We finish the section with the proof of periodicity of the sequence \((x^{\left\lfloor \frac{m}{p}\right\rfloor p(1-p)}W_{p,m}(x)\pmod {p})_{m\in \mathbb {N}}\).

In Sect. 7 we deal with divisors of the number \(H_d(n)\). The section is divided into three parts. In the first part we show that for each \(d\ge 2\) the set of prime divisors of numbers \(H_d(n)\) is infinite. In the second part we compute the greatest common divisor of numbers \(H_d(n)-1\) and n. As a consequence, we get that the set prime divisors of numbers \(H_{d}(n)-1\), \(n\in \mathbb {N}\), is whole \(\mathbb {P}\). The last part is devoted to the study of values \(2\le a<b\), \(n\in \mathbb {N}\) and \(c\in \mathbb {N}_{\ge 2}\) such that c divides both \(H_a(n)\) and \(H_b(n)\).

In Sect. 8 we introduce the sequence of polynomials \((H_d(n,x))_{n\in \mathbb {N}}\) being a generalizations of the sequence \((H_d(n))_{n\in \mathbb {N}}\). Namely, \(H_d(n,1)=H_d(n)\) and the coefficient near the \(x^k\) in the polynomial \(H_d(n,x)\) is the number of those permutations in \(S_n\) which are products of pairwise disjoint d-cycles and have exactly k fixed points. After that, we compute the remainders of polynomials \(H_d(n,x)\) modulo d and study coefficients of the polynomials \(H_2(n-1,x)H_2(n+1,x)-H_2(n,x)^2\) and \(H_d(n-d,x)H_d(n+d,x)-H_d(n,x)^2\). In particular, we prove that if \(U(n,x)=H_2(n-1,x)H_2(n+1,x)-H_2(n,x)^2\), then \(U(n,x)=V(n,x^2)\), where \(V\in \mathbb {Z}[x]\) has degree \(n-1\) and all the coefficients of V near \(x^{i}, i\ne 0, n-1\) are positive. Moreover, among some identities and congruences the most interesting result of this section is the result which says that the congruence \(H_d(n-d,x)H_d(n+d,x)\equiv H_d(n,x)^2\pmod {d!}\) is true if and only if d is a prime number or a square of a prime number.

Section 9 collects some observations, questions and conjectures related to objects introducted in previous sections.

2 First results

For \(d\in \mathbb {N}_{\ge 2}\) we have \(H_{d}(i)=1\) for \(i\in \{0,1,\ldots ,d-1\}\) by definition and for \(n\ge d\) the standard combinatorial argument shows that

$$\begin{aligned} H_{d}(n)=H_{d}(n-1)+(n-1)_{(d-1)}H_{d}(n-d), \end{aligned}$$
(1)

where as usual, for \(m\in \mathbb {N}\) the symbol \((u)_{(m)}\) denotes the falling factorial defined as

$$\begin{aligned} (u)_{(m)}=u(u-1)\cdots (u-(m-1)). \end{aligned}$$

Indeed, let us fix \(\sigma \in S_{d,n}\). If \(\sigma (n)=n\) then \(\sigma =\sigma _1\) for some \(\sigma _1\in S_{d,n-1}\) and it can be chosen by \(H_d(n-1)\) ways. If \(\sigma (n)\ne n\) then \(\sigma =\sigma _1\circ \pi \), where \(\pi \) is a d-cycle containing n and \(\sigma _1\) is a product of pairwise disjoint d-cycles on a set \(\{1,\ldots ,n\}\backslash \text{ supp }(\pi )\). Then \(\sigma _1\) can be treated as a member of the set \(S_{d,n-d}\). Thus, it can be chosen by \(H_d(n-d)\) ways. Moreover, \(\pi \) can be chosen in \((n-1)_{(d-1)}\) ways.

Furthermore, in the sequel we will also use the convention \(H_{d}(n)=0\) for \(n<0\). As a simple consequence of the recurrence formula we see that if \(q\in \mathbb {N}\), with \(q\mid (d-1)!\), then \(H_{d}(n)\equiv 1\pmod {q}\) for each \(n\in \mathbb {N}\). In particular, if d is a composite number \(>4\), then \(H_{d}(n)\equiv 1\pmod {d}\). Moreover, if p is a prime number \(<d\), then \(\nu _p(H_d(n))=0\) for each \(n\in \mathbb {N}\).

It is well known that the exponential generating function for the sequence \((H_{d}(n))_{n\in \mathbb {N}}\) is given by

$$\begin{aligned} \mathcal {H}_{d}(x)=\sum _{n=0}^{\infty }\frac{H_{d}(n)}{n!}x^{n}=e^{x+\frac{x^{d}}{d}}. \end{aligned}$$

In consequence, the exact expression for \(H_{d}(n)\) is given by

$$\begin{aligned} H_{d}(n)=\sum _{k=0}^{\lfloor \frac{n}{d}\rfloor }\frac{n!}{(n-dk)!k!}\frac{1}{d^{k}}. \end{aligned}$$
(2)

The knowledge of the closed form of exponential generating function allows us to obtain some identities involving numbers \(H_d(n)\).

Theorem 2.1

The following identities are true.

  1. (1)
    $$\begin{aligned} \sum _{k=0}^{n}{n\atopwithdelims ()k}(-1)^{n-k}H_{d}(k)={\left\{ \begin{array}{ll} \begin{array}{ll} 0, &{} \quad \text{ if }\;n\not \equiv 0\pmod {d}\\ \frac{(md)!}{m!d^{m}}, &{} \quad \text{ if }\;n=md. \end{array} \end{array}\right. } \end{aligned}$$
  2. (2)

    For \(n\in \mathbb {N}_{+}\) and \(d\in \mathbb {N}_{\ge 3}\) an odd number we have

    $$\begin{aligned} \sum _{k=0}^{n}{n\atopwithdelims ()k}(-1)^{k}H_{d}(k)H_{d}(n-k)=0. \end{aligned}$$
  3. (3)

    For \(n\in \mathbb {N}_{+}\) and \(d\in \mathbb {N}_{\ge 2}\) an even number we have

    $$\begin{aligned} \sum _{k=0}^{n}{n\atopwithdelims ()k}(-1)^{k}H_{d}(k)H_{d}(n-k)={\left\{ \begin{array}{ll} \begin{array}{ll} 0, &{} \quad \text{ if }\;n\not \equiv 0\pmod {d}\\ \frac{(md)!}{m!\left( \frac{d}{2}\right) ^{m}},&{} \quad \text{ if }\;n=md. \end{array} \end{array}\right. } \end{aligned}$$
  4. (4)

    Let \(\zeta _{d}\) be a d-th root of unity. Then

    $$\begin{aligned} H_{d}(n)=\zeta _{d}^{-n}\sum _{k=0}^{n}{n\atopwithdelims ()k}(\zeta _{d}-1)^{k}H_{d}(n-k). \end{aligned}$$
  5. (5)

    Let \(\zeta _{2d}\) be a 2d-th root of unity satisfying \(\zeta _{2d}^d=-1\). Then

    $$\begin{aligned} \sum _{k=0}^{n}{n\atopwithdelims ()k}\zeta _{2d}^{k}H_{d}(k)H_{d}(n-k)=(1+\zeta _{2d})^{n}. \end{aligned}$$
  6. (6)

    Let d be an even number and \((B_{n})_{n\in \mathbb {N}}\) denote the sequence of Bernoulli numbers. Then

    $$\begin{aligned} \sum _{k=0}^{\lfloor \frac{n}{2}\rfloor }\left( {\begin{array}{c}n\\ 2k\end{array}}\right) \frac{2^{n-2k}}{2k+1}B_{n-2k}H_{d}(2k+1)=(-1)^{n}H_{d}(n). \end{aligned}$$
  7. (7)

    For \(n\in \mathbb {N}\) we have the identity

    $$\begin{aligned} H_{d}(n)=1+\sum _{i=1}^{n}(i-1)_{(d-1)}H_{d}(i-d). \end{aligned}$$

Proof

The identities (1)–(6) can be easily proved with the help of generating functions technique. Indeed, it is well known that for

$$\begin{aligned} f(x)=\sum _{n=0}^{\infty }\frac{a_{n}}{n!}x^{n},\quad g(x)=\sum _{n=0}^{\infty }\frac{b_{n}}{n!}x^{n} \end{aligned}$$

we have \(f(x)g(x)=\sum _{n=0}^{\infty }\frac{c_{n}}{n!}x^{n}\) with

$$\begin{aligned} c_{n}=\sum _{k=0}^{n}\left( {\begin{array}{c}n\\ k\end{array}}\right) a_{k}b_{n-k}. \end{aligned}$$

In order to get the first identity we write \(f(x)=\mathcal {H}_{d}(x)\) and \(g(x)=e^{-x}\) and get \(f(x)g(x)=e^{\frac{x^{d}}{d}}\). Comparing the coefficients on the both sides of this identity we get the result.

In order to get the second identity we put \(f(x)=\mathcal {H}_{d}(x), g(x)=\mathcal {H}_{d}(-x)\). Because \(d\ge 3\) is odd then \(f(x)g(x)=1\) and hence the result.

The third identity can be proved in the same way. Taking d even and \(f(x)=\mathcal {H}_{d}(x), g(x)=\mathcal {H}_{d}(-x)\) we get \(f(x)g(x)=e^{2\frac{x^{d}}{d}}\) and hence the result.

In order to get the fourth identity we put \(f(x)=e^{(1-\zeta _{d})x}, g(x)=\mathcal {H}_{d}(\zeta _{d}x)\). Then \(f(x)g(x)=\mathcal {H}_{d}(x)\) and the identity follows.

The fifth identity follows by taking \(f(x)=\mathcal {H}_{d}(\zeta _{2d}x), g(x)=\mathcal {H}_{d}(x)\). In this case \(f(x)g(x)=e^{(1+\zeta _{2d})x}\) and we get required identity.

In order to get the sixth identity we put

$$\begin{aligned} f(x)=2x/(e^{2x}-1)=\sum _{n=0}^{\infty }\frac{2^{n}B_{n}}{n!}x^{n}, \end{aligned}$$

i.e., f is the exponential generating function of the sequence \((2^{n}B_{n})_{n\in \mathbb {N}}\), and

$$\begin{aligned} g(x)=\frac{1}{2x}(\mathcal {H}_{d}(x)-\mathcal {H}_{d}(-x))=\sum _{n=0}^{\infty }\frac{A_{n}}{n!}x^{n}, \end{aligned}$$

where \(A_{n}=0\) for n odd and \(A_{n}=H_{d}(n+1)/(n+1)\) for n even. With fg chosen in this way we get \(f(x)g(x)=\mathcal {H}_{d}(-x)\) and comparing the coefficients near \(x^{n}\) on both sides of this identity we get the result.

The last identity is a consequence of the recurrence relation (1). Indeed, rewriting (1) as \(H_{d}(m)-H_{d}(m-1)=(m-1)_{(d-1)}H_{d}(m-d)\) and summing from \(m=1\) to n on both sides we get telescoping sum on the left and get

$$\begin{aligned} H_{d}(n)-H_{d}(0)=\sum _{i=1}^{n}(i-1)_{(d-1)}H_{d}(i-d). \end{aligned}$$

The result follows. \(\square \)

3 Periodicity of the numbers \(H_d(n)\) modulo a given positive integer

We know that if \(c<d\) or \(c=d>4\) is a composite number then the sequence \((H_d(n)\pmod {c})_{n\in \mathbb {N}}\) is constant and equal to 1. In this section we present some results concerning periodicity of the sequences \((H_d(n)\pmod {c})_{n\in \mathbb {N}}\) when \(c>d\). We start with cases \(c\in \{d+1,d+2\}\). As we will see, the behaviour of the sequence \((H_d(n)\pmod {c})_{n\in \mathbb {N}}\) depends mainly on the question whether c is a prime or not.

Proposition 3.1

Let p be an odd prime number. Then for each \(n\in \mathbb {N}\) we have

$$\begin{aligned} H_{p-1}(n)\equiv {\left\{ \begin{array}{ll} 1,&{}\quad \text{ if } n\not \equiv -1\pmod {p}\\ 2,&{}\quad \text{ if } n\equiv -1\pmod {p} \end{array}\right. } \pmod {p}. \end{aligned}$$
(3)

In particular, \(\nu _p(H_{p-1}(n))=0\) for any \(n\in \mathbb {N}\).

If additionally \(p>3\), then

$$\begin{aligned} H_{p-2}(n)\equiv {\left\{ \begin{array}{ll} \begin{array}{ll} 1, &{}\quad \text{ if } n\not \equiv -1,-2\pmod {p}\\ \frac{p+1}{2},&{}\quad \text{ if } n\equiv -2\pmod {p}\\ \frac{p+3}{2},&{}\quad \text{ if } n\equiv -1\pmod {p} \end{array} \end{array}\right. } \pmod {p}. \end{aligned}$$
(4)

As a result, \(\nu _p(H_{p-2}(n))=0\) for any \(n\in \mathbb {N}\).

Proof

We start with the computation of \(H_{p-1}(n)\pmod {p}\). We proceed by induction on \(n\in \mathbb {N}\). For \(n\in \{0,\ldots ,p-2\}\) we have \(H_{p-1}(n)=1\). Let us fix now \(N\ge p-1\) and assume that congruence (3) is satisfied for each \(n<N\). If \(N\not \equiv -1,0\pmod {p}\) then by (1) we have

$$\begin{aligned} H_{p-1}(N)&=H_{p-1}(N-1)+(N-1)_{(p-2)}H_{p-1}(N-p+1)\\&\equiv H_{p-1}(N-1)\equiv 1\pmod {p}, \end{aligned}$$

since in the product of numbers \(N-1,\ldots ,N-p+2\) there is a number divisible by p and \(N-1\not \equiv -1\pmod {p}\), which means that \(H_{p-1}(N-1)\equiv 1\pmod {p}\). If \(N\equiv 0\pmod {p}\), then

$$\begin{aligned} H_{p-1}(N)&=H_{p-1}(N-1)+(N-1)_{(p-2)}H_{p-1}(N-p+1)\\&\equiv H_{p-1}(N-1)+(p-1)!H_{p-1}(N-p+1)\equiv 2-1=1\pmod {p}, \end{aligned}$$

since \(N-1\equiv -1\pmod {p}\), \(N-p+1\equiv 1\not \equiv -1\pmod {p}\) (\(p>2\)) and by Wilson’s theorem \((p-1)!\equiv -1\pmod {p}\). If \(N\equiv -1\pmod {p}\), then

$$\begin{aligned} H_{p-1}(N)&=H_{p-1}(N-1)+(N-1)_{(p-2)}H_{p-1}(N-p+1)\\&\equiv H_{p-1}(N-1)+(p-2)!H_{p-1}(N-p+1)\equiv 1+1=2\pmod {p}, \end{aligned}$$

since \(N-1\) and \(N-p+1\) are not congruent to \(-1\) modulo p and \((p-2)!\equiv 1\pmod {p}\) as an immediate consequence of Wilson’s theorem.

The proof of congruence (4) is analogous. We proceed by induction on \(n\in \mathbb {N}\). For \(n\in \{0,\ldots ,p-3\}\) we have \(H_{p-2}(n)=1\). Let us fix now \(N\ge p-2\) and assume that congruence (4) is satisfied for each \(n<N\). If \(N\not \equiv -2,-1,0\pmod {p}\), then by (1) we have

$$\begin{aligned} H_{p-2}(N)&=H_{p-2}(N-1)+(N-1)_{(p-3)}H_{p-2}(N-p+2)\\&\equiv H_{p-2}(N-1)\equiv 1\pmod {p}, \end{aligned}$$

since in the product of numbers \(N-1,\ldots ,N-p+3\) there is a number divisible by p and \(N-1\not \equiv -2,-1\pmod {p}\), which means that \(H_{p-1}(N-1)\equiv 1\pmod {p}\). If \(N\equiv 0\pmod {p}\), then

$$\begin{aligned} H_{p-2}(N)&=H_{p-2}(N-1)+(N-1)_{(p-3)}H_{p-2}(N-p+2)\\&\equiv H_{p-2}(N-1)+\frac{(p-1)!}{2}H_{p-2}(N-p+2)\\&\equiv \frac{p+3}{2}-\frac{1}{2}=\frac{p}{2}+1\equiv 1\pmod {p}, \end{aligned}$$

since \(N-1\equiv -1\pmod {p}\), \(N-p+2\equiv 2\not \equiv -2,-1\pmod {p}\) (\(p\ge 5\)) and by Wilson’s theorem \((p-1)!\equiv -1\pmod {p}\). If \(N\equiv -1\pmod {p}\), then

$$\begin{aligned} H_{p-2}(N)&=H_{p-2}(N-1)+(N-1)_{(p-3)}H_{p-2}(N-p+2)\\&\equiv H_{p-2}(N-1)+(p-2)!H_{p-2}(N-p+2)\\&\equiv \frac{p+1}{2}+1=\frac{p+3}{2}\pmod {p}, \end{aligned}$$

since \(N-1\equiv -2\pmod {p}\), \(N-p+2\equiv 1\not \equiv -2,-1\pmod {p}\) (\(p\ge 5\)) and \((p-2)!\equiv 1\pmod {p}\) as an immediate consequence of Wilson’s theorem. If \(N\equiv -2\pmod {p}\), then

$$\begin{aligned} H_{p-2}(N)&=H_{p-2}(N-1)+(N-1)_{(p-3)}H_{p-2}(N-p+2)\\&\equiv H_{p-2}(N-1)+(p-3)!H_{p-2}(N-p+2)\equiv 1-\frac{1}{2}=\frac{1}{2}\pmod {p}, \end{aligned}$$

since \(N-1\equiv -3\not \equiv -2,-1\pmod {p}\), \(N-p+2\equiv 0\not \equiv -2,-1\pmod {p}\) (\(p\ge 5\)) and \((p-3)!\equiv -\frac{1}{2}\pmod {p}\) as an easy consequence of Wilson’s theorem. \(\square \)

Proposition 3.2

Let d be a positive integer at least 5. If \(d+1\) is a composite number, then for each \(n\in \mathbb {N}\) we have \(H_{d}(n)\equiv 1\pmod {d+1}\).

Let d be a positive integer at least 4. If \(d+2\) is a composite number, then for each \(n\in \mathbb {N}\) we have \(H_{d}(n)\equiv 1\pmod {d+2}\).

Proof

Since \(H_d(n)=1\) for \(n\in \{0,\ldots ,d-1\}\), \(H_{d}(n)=H_{d}(n-1)+(n-1)_{(d-1)}H_{d}(n-d)\) for \(n\ge d\) and \((d-1)!\mid (n-1)_{(d-1)}\) for any \(n\in \mathbb {N}\), it suffices to prove that \(d+1\mid (d-1)!\) in the first part of the statement of our theorem and \(d+2\mid (d-1)!\) in the second part.

At first, we show \(d+1\mid (d-1)!\) if \(d\ge 5\) and \(d+1\) is a composite number. Let q be the least divisor of \(d+1\) greater than 1. Then \(\frac{d+1}{q}\le \frac{d+1}{2}<d-1\), since \(d\ge 5\). If \(q<\frac{d+1}{q}\), then q and \(\frac{d+1}{q}\) are two distinct positive integers appearing as factors in \((d-1)!\), thus \(d+1\mid (d-1)!\). If \(q=\frac{d+1}{q}\) then \(d+1=q^2\). Since \(d+1\ge 6\) thus \(q\ge 3\). Then \(2q<q^2-2=d-1\) and q, 2q appear as factors in \((d-1)!\). Hence \(d+1\mid (d-1)!\).

Now we prove \(d+2\mid (d-1)!\) if \(d\ge 4\) and \(d+2\) is a composite number. Let q be the least divisor of \(d+2\) greater than 1. Then \(\frac{d+2}{q}\le \frac{d+2}{2}\le d-1\), since \(d\ge 4\). If \(q<\frac{d+2}{q}\), then q and \(\frac{d+2}{q}\) are two distinct positive integers appearing as factors in \((d-1)!\), thus \(d+2\mid (d-1)!\). If \(q=\frac{d+2}{q}\) then \(d+2=q^2\). Since \(d+2\ge 6\) thus \(q\ge 3\). Then \(2q\le q^2-3=d-1\) and q, 2q appear as factors in \((d-1)!\). Hence \(d+1\mid (d-1)!\). \(\square \)

According to the last proposition and numerical computations, we prove that for a fixed positive integer k and for a sufficiently large positive integer d such that \(d+k\) is a composite number, the sequence \((H_d(n)\pmod {d+k})_{n\in \mathbb {N}}\) is constant and equal to 1.

Theorem 3.3

Let us fix \(k\in \mathbb {N}_+\). Then for each positive integer \(d\ge \max \{k+2,3+2\sqrt{k+2}\}\) such that \(d+k\) is a composite number there holds \(H_d(n)\equiv 1\pmod {d+k}\) for all \(n\in \mathbb {N}\).

Proof

Similarly as in the proof of the previous proposition, it suffices to show that \(d+k\mid (d-1)!\). Let q be the least divisor of \(d+k\) greater than 1. Then \(\frac{d+k}{q}\le \frac{d+k}{2}\le d-1\), since \(d\ge k+2\). If \(q<\frac{d+k}{q}\), then q and \(\frac{d+k}{q}\) are two distinct positive integers appearing as factors in \((d-1)!\), thus \(d+k\mid (d-1)!\). If \(q=\frac{d+k}{q}\) then \(d+k=q^2\). Since \(3+2\sqrt{k+2}=(1+\sqrt{k+2})^2-k\) and \(d\ge (1+\sqrt{k+2})^2-k\), we have \(q=\sqrt{d+k}\ge 1+\sqrt{k+2}\). As a consequence, \(2q\le q^2-k-1=d-1\) and q, 2q appear as factors in \((d-1)!\). Hence \(d+k\mid (d-1)!\). \(\square \)

For our next result, we need the following auxiliary lemma.

Lemma 3.4

Let p be a prime number and d be a composite positive integer divisible by p. Assume that \((p,d)\ne (2,4)\). Then \(\frac{d-2}{p}\ge \nu _p(d)\).

Proof

If \(\nu _p(d)=1\) then \(d\ge 2p\) as d is a composite number. We thus have

$$\begin{aligned} \frac{d-2}{p}\ge \frac{2p-2}{p}=2-\frac{2}{p}\ge 1 \end{aligned}$$

as \(p\ge 2\). If \(p\ge 3\) and \(\nu _p(d)\ge 2\) or \(p=2\) and \(\nu _2(d)\ge 3\) then

$$\begin{aligned} \frac{d}{p}\ge \frac{p^{\nu _p(d)}}{p}=p^{\nu _p(d)-1}\ge \nu _p(d)+1\ge \nu _p(d)+\frac{2}{p}, \end{aligned}$$

which implies \(\frac{d-2}{p}\ge \nu _p(d)\). If \(p=2\), \(\nu _2(d)=2\) and \(d\ne 4\) then \(d\ge 3\cdot 4\) and

$$\begin{aligned} \frac{d-2}{2}\ge \frac{12-2}{2}=5>2=\nu _2(d). \end{aligned}$$

Our lemma is proved. \(\square \)

We are ready to prove the main result of the section. It concerns periodicity of the sequence \((H_d(n)\pmod {p^r})_{n\in \mathbb {N}}\), where p is a prime number not equal to d and r is any positive integer. More precisely, we have the following

Theorem 3.5

Let d and r be positive integers with \(d\ge 2\). Let p be a prime number not equal to d. Assume that \((d,p,r)\ne (4,2,2)\). Then the sequence \((H_d(n)\pmod {p^r})_{n\in \mathbb {N}}\) is periodic of period \(p^r\). Moreover, if \(p>d\), then \(p^r\) is the basic period of the sequence \((H_d(n)\pmod {p^r})_{n\in \mathbb {N}}\).

Proof

Let us notice that for the proof that \(p^r\) is a period of \((H_d(n)\pmod {p^r})_{n\in \mathbb {N}}\) we only need to show that

$$\begin{aligned} H_d(p^r)\equiv H_d(0)=1\pmod {p^r}. \end{aligned}$$
(5)

Then, using (1) and a simple induction on \(n\in \mathbb {N}\), we prove that \(H_d(n+p^r)\equiv H_d(n)\pmod {p^r}\).

In order to prove (5) for \((d,p)\ne (4,2)\) we will use the exact formula

$$\begin{aligned} H_d(p^r)=\sum _{k=0}^{\lfloor \frac{p^r}{d}\rfloor }\frac{p^r!}{(p^r-dk)!k!}\frac{1}{d^{k}} \end{aligned}$$
(6)

and show that for \(k\ge 1\), the k-th summand in the above sum has the p-adic valuation greater than or equal to r. We write this summand:

$$\begin{aligned} \frac{p^r!}{(p^r-dk)!k!}\frac{1}{d^{k}}=p^r\frac{(p^r-1)!}{(p^r-dk)!k!}\frac{1}{d^{k}}=p^r\frac{(p^r-1)_{(dk-1)}}{k!}\frac{1}{d^{k}}. \end{aligned}$$

It suffices to show that \(\nu _p\left( \frac{(p^r-1)_{(dk-1)}}{k!}\frac{1}{d^{k}}\right) \ge 0\). If \(\nu _p(d)=0\) then the mentioned inequality is true. We thus assume that \(\nu _p(d)>0\). Since \((dk-1)!\mid (p^r-1)_{(dk-1)}\), we have

$$\begin{aligned} \nu _p\left( \frac{(p^r-1)_{(dk-1)}}{k!}\frac{1}{d^{k}}\right) \ge \nu _p\left( \frac{(dk-1)!}{k!}\frac{1}{d^{k}}\right) =\nu _p((dk-1)_{((d-1)k-1)})-k\nu _p(d). \end{aligned}$$

We estimate \(\nu _p((dk-1)_{((d-1)k-1)})\) from below by number of multiples of p among factors \(dk-1, dk-2, \ldots , k+1\) and use Lemma 3.4 to obtain the following.

$$\begin{aligned} \nu _p((dk-1)_{((d-1)k-1)})>\frac{(d-1)k-1}{p}-1\ge \frac{k(d-2)}{p}-1\ge k\nu _p(d)-1. \end{aligned}$$

This implies \(\nu _p\left( \frac{(p^r-1)_{(dk-1)}}{k!}\frac{1}{d^{k}}\right) \ge 0\) and finishes the proof of (5) in case of \((d,p)\ne (4,2)\).

If \((d,p)=(4,2)\) and \(r\ge 3\), then we compute the 2-adic valuations of the summands of (6) for \(k\in \{1,2\}\).

$$\begin{aligned}&\nu _2\left( \frac{2^r!}{(2^r-4)!\cdot 4}\right) =\nu _2\left( \frac{2^r(2^r-1)(2^r-2)(2^r-3)}{4}\right) \\&\quad =r+0+1+0-2=r-1\\&\nu _2\left( \frac{2^r!}{(2^r-8)!2!\cdot 4^2}\right) \\&\quad =\nu _2\left( \frac{2^r(2^r-1)(2^r-2)(2^r-3)(2^r-4)(2^r-5)(2^r-6)(2^r-7)}{2\cdot 4^2}\right) \\&\quad =r+0+1+0+2+0+1+0-1-2\cdot 2=r-1 \end{aligned}$$

Thus the 2-adic valuation of the sum of these two summands is at least equal to r. Now we show, that for the 2-adic valuation of the summand of (6) for \(k\ge 3\) is greater than or equal to r. As in the case of \((d,p)\ne (4,2)\), we write this summand

$$\begin{aligned} \frac{2^r!}{(2^r-4k)!k!}\frac{1}{4^{k}}=2^r\frac{(2^r-1)!}{(2^r-4k)!k!}\frac{1}{4^{k}}=2^r\frac{(2^r-1)_{(4k-1)}}{k!}\frac{1}{4^{k}} \end{aligned}$$

and prove that \(\nu _2\left( \frac{(2^r-1)_{(4k-1)}}{k!}\frac{1}{4^{k}}\right) \ge 0\). Since \((4k-1)!\mid (2^r-1)_{(4k-1)}\), we have

$$\begin{aligned} \nu _2\left( \frac{(2^r-1)_{(4k-1)}}{k!}\frac{1}{4^{k}}\right) \ge \nu _2\left( \frac{(4k-1)!}{k!}\frac{1}{4^{k}}\right) =\nu _p((4k-1)_{(3k-1)})-2k. \end{aligned}$$

If \(k=3\), then \(\nu _2((4k-1)_{(3k-1)})-2k=\nu _2((11)_{(8)})-6=7-6=1\). If \(k\ge 4\), then we estimate \(\nu _2((4k-1)_{(3k-1)})\) from below by the sum of the number of multiples of 2 and the number of multiples of 4 among factors \(3k-1, 3k-2, \ldots , k+1\) to obtain the following.

$$\begin{aligned} \nu _2((4k-1)_{(3k-1)})-2k>\frac{3k-1}{2}-\frac{1}{2}+\frac{3k-1}{4}-\frac{3}{4}-2k=\frac{k-8}{4}\ge -\frac{1}{2}. \end{aligned}$$

This implies \(\nu _p\left( \frac{(p^r-1)_{(dk-1)}}{k!}\frac{1}{d^{k}}\right) \ge 0\) and finishes the proof of (5) in case of \((d,p)\ne (4,2)\).

We need to show that \(p^r\) is the basic period of the sequence \((H_d(n)\pmod {p^r})_{n\in \mathbb {N}}\) provided that \(p>d\). Let us assume by contrary that \(p^{r-1}\) is a period of \((H_d(n)\pmod {p^r})_{n\in \mathbb {N}}\). If \(r=1\) then we directly obtain a contradiction, since the sequence \((H_d(n)\pmod {p})_{n\in \mathbb {N}}\) is not constant. Indeed, \(H_d(d)=1+(d-1)!\not \equiv 1\pmod {p}\) as \(d<p\). If \(r>1\), then we consider the congruences

$$\begin{aligned} H_d(p^{r-1}+d)&\equiv H_d(d)\pmod {p^r},\\ H_d(p^{r-1}+d+1)&\equiv H_d(d+1)\pmod {p^r}, \end{aligned}$$

that are equivalent to

$$\begin{aligned}&H_d(p^{r-1}+d-1)+(p^{r-1}+d-1)_{(d-1)}H_d(p^{r-1})\\&\quad \equiv H_d(d-1)+(d-1)!H_d(0)\pmod {p^r},\\&H_d(p^{r-1}+d)+(p^{r-1}+d)_{(d-1)}H_d(p^{r-1}+1)\\&\quad \equiv H_d(d)+d!H_d(1)\pmod {p^r}. \end{aligned}$$

Since \(H_d(p^{r-1}+d-1)\equiv H_d(d-1)\pmod {p^r}\), \(H_d(p^{r-1}+d)\equiv H_d(d)\pmod {p^r}\) and \(H_d(p^{r-1})\equiv H_d(0)\equiv H_d(p^{r-1}+1)\equiv H_d(1)\equiv 1\pmod {p^r}\), we get the following:

$$\begin{aligned} (p^{r-1}+d-1)_{(d-1)}&\equiv (d-1)!\pmod {p^r},\\ (p^{r-1}+d)_{(d-1)}&\equiv d!\pmod {p^r}, \end{aligned}$$

and equivalently

$$\begin{aligned} (d-1)!+p^{r-1}(d-1)!\sum _{j=1}^{d-1}\frac{1}{j}&\equiv (d-1)!\pmod {p^r},\\ d!+p^{r-1}d!\sum _{j=2}^d\frac{1}{j}&\equiv d!\pmod {p^r}. \end{aligned}$$

After simplification (where we divide by \((d-1)!\) and d!, respectively, and these numbers are coprime to p) we obtain two congruences

$$\begin{aligned} \sum _{j=1}^{d-1}\frac{1}{j}&\equiv 0\pmod {p},\\ \sum _{j=2}^d\frac{1}{j}&\equiv 0\pmod {p}. \end{aligned}$$

Subtracting the second congruence from the first one, we get \(1-\frac{1}{d}\equiv 0\pmod {p}\), or equivalently \(\frac{d-1}{d}\equiv 0\pmod {p}\). This is impossible since \(0<d-1<p\). Hence \(p^r\) must be the basic period of the sequence \((H_d(n)\pmod {p^r})_{n\in \mathbb {N}}\). \(\square \)

Remark 3.6

In the case of \((d,p,r)=(4,2,2)\) the sequence \((H_4(n)\pmod {4})_{n\in \mathbb {N}}\) has the basic period 8. More precisely, we have

$$\begin{aligned} H_{4}(n)\equiv {\left\{ \begin{array}{ll} 1,&{}\quad \text{ if } n\equiv 0,1,2,3\pmod {8}\\ 3,&{}\quad \text{ if } n\equiv 4,5,6,7\pmod {8} \end{array}\right. } \pmod {4}. \end{aligned}$$

Proof

We prove by induction on \(m\in \mathbb {N}\) that

$$\begin{aligned} H_4(8m+i)\equiv {\left\{ \begin{array}{ll} 1,&{}\quad \text{ if } i\in \{0,1,2,3\}\\ 3,&{}\quad \text{ if } i\in \{4,5,6,7\} \end{array}\right. } \pmod {4}. \end{aligned}$$
(7)

We check that congruence (7) holds for \(m=0\) and \(i\in \{0,1,2,3,4,5,6,7\}\). Assume now that it is satisfied by some \(m\in \mathbb {N}\). By direct calculations we show (7) for \(m+1\). \(\square \)

Example 3.7

If \(p<d\), then it is possible that \(p^r\) is not the basic period of the sequence \((H_d(n)\pmod {p^r})_{n\in \mathbb {N}}\). For example, if \(d=5\), \(p=2\), \(r=4\), then we obtain a sequence \((H_5(n)\pmod {16})_{n\in \mathbb {N}}\), which has a period \(8<2^4\).

Another example is for \(d=10\), \(p=3\), \(r=5\). The basic period of the sequence \((H_{10}(n)\pmod {243})_{n\in \mathbb {N}}\) is \(27<3^5\).

Based on the above considerations we can give precise value of the period of the sequence \((H_d(n)\pmod {c})_{n\in \mathbb {N}}\) provided that d is a composite number or \(d\not \mid c\).

Corollary 3.8

Let \(c,d\in \mathbb {N}_+\) and \(d>1\). Assume additionally that d is a composite number or \(d\not \mid c\). Then the sequence \((H_d(n)\pmod {c})_{n\in \mathbb {N}}\) is periodic of period 2c if \(d=4\) and \(\nu _2(c)=2\) and c otherwise.

4 The behaviour of the p-adic valuation of \(H_{p}(n)\) for some p

Amdeberhan and Moll were able to compute the exact value of the 2-adic valuation of \(H_{2}(n)\) for \(n\in \mathbb {N}\). Quite unexpected they proved that for given \(i\in \{0,1,2,3\}\) the sequence \((\nu _{2}(H_{2}(4n+i))-n)_{n\in \mathbb {N}}\) is constant. This raises natural question whether the sequence of p-adic valuations of \(H_{p}(n)\) can share similar property. In fact, this question was studied earlier by Ochiai [10]. In the cited paper the reader can find the formulae for the p-adic valuation of the numbers \(H_p(n)\), \(n\in \mathbb {N}\), where p is a prime number at most equal to 11. Actually, Ochiai in his paper gave a qualitative description of the sequence \((\nu _p(H_p(n)))_{n\in \mathbb {N}}\) for any prime number \(p\le 23\). Further, Ishihara, Ochiai, Takegahara and Yoshida extend this result for any prime number p in [6]. In particular, the following inequality holds true

$$\begin{aligned} \nu _p(H_p(n))\ge \left\lfloor \frac{n}{p^2}\right\rfloor \cdot (p-1)+\left( \left\lfloor \frac{n}{p}\right\rfloor \pmod {p}\right) \end{aligned}$$
(8)

for all \(n\in \mathbb {N}\), where the equality holds if \(p\mid \left\lfloor \frac{n}{p}\right\rfloor \). This inequality was proved for \(p=2\) by Chowla et al. [3]. In general, this inequality was proved by Grady and Newman [5]. Moreover, in 2010 Kim and Kim gave a combinatorial proof of the above inequality. Despite this facts we would like to give the proof of (8) different than the ones presented by mentioned authors. In consequence, we will be able to prove the following two results which have not appeared yet in the literature.

Theorem 4.1

For each odd prime number p the sequence

$$\begin{aligned} \left( (-1)^{\left\lfloor \frac{n}{p^2}\right\rfloor }\frac{H_p(n)}{p^{\left\lfloor \frac{n}{p^2}\right\rfloor \cdot (p-1)+\left( \left\lfloor \frac{n}{p}\right\rfloor \pmod {p}\right) }}\pmod {p}\right) _{n\in \mathbb {N}} \end{aligned}$$

is periodic with the basic period \(p^2\). Moreover, the sequence

$$\begin{aligned} \left( \frac{H_p(n)}{p^{\left\lfloor \frac{n}{p^2}\right\rfloor \cdot (p-1)+\left( \left\lfloor \frac{n}{p}\right\rfloor \pmod {p}\right) }}\pmod {p}\right) _{n\in \mathbb {N}} \end{aligned}$$

has basic period equal to \(2p^2\).

Proposition 4.2

For each prime number p there are numbers \(b_0,\ldots ,b_{p-1}\in \{0,\ldots ,p-1\}\) such that \(b_0=p-1\), \(b_{j-1}-b_j\in \{0,1\}\) for \(j\in \{1,\ldots ,p-1\}\) and \(\nu _p(H_p(kp^2+jp+b_j))=k(p-1)+j\) for all \(k\in \mathbb {N}\) and \(j\in \{0,\ldots ,p-1\}\). In particular, \(b_j\ge p-j-1\).

We start with one lemma. We omit its proof as it can be found in [6, Lemma 2.2].

Lemma 4.3

If p is an odd prime number and k is a positive integer then

$$\begin{aligned} \sum _{1\le l_k\le \cdots \le l_1\le p-1} \frac{1}{l_1\cdots l_k}\equiv {\left\{ \begin{array}{ll} 1,&{}\quad \text{ when } p-1\mid k\\ 0,&{}\quad \text{ when } p-1\not \mid k \end{array}\right. }\pmod {p}. \end{aligned}$$

At this moment, we give a result on congruences involving numbers \(H_p(n)\), \(n\in \mathbb {N}\). This result is crucial in the proof of Theorem 4.1.

Theorem 4.4

For odd prime number p, a non-negative integer k and integers \(i,j\in \{0,1,\ldots ,p-1\}\) we have

$$\begin{aligned} H_p(kp^2)&\equiv (-1)^kp^{k(p-1)}\pmod {p^{k(p-1)+1}},\\ H_p(kp^2+jp)&\equiv 0\pmod {p^{k(p-1)+j}},\\ H_p(kp^2+jp+i)&\equiv H_p(kp^2+jp)\\&\quad +\sum _{t=1}^j (-1)^t(j)_{(t)}p^tH_p(kp^2+(j-t)p)\\&\qquad \sum _{1\le l_t\le \cdots \le l_1\le i}\frac{1}{l_1\cdots l_t}\pmod {p^{k(p-1)+j+1}}. \end{aligned}$$

Proof

We prove the congruences concerning numbers \(H_p(n)\) for \(n\in \mathbb {N}\). We proceed by induction on n. We write \(n=kp^2+jp+i\) with \(k\in \mathbb {N}\) and \(i,j\in \{0,\ldots ,p-1\}\). If \(k=j=0\), then the statement of the theorem holds for all \(i\in \{0,\ldots ,p-1\}\).

Let us assume that \(n=kp^2\) for some \(k\in \mathbb {N}_+\). By induction hypothesis for \((k-1)p^2+(p-1)p+p-1\) and \((k-1)p^2+(p-1)p\), Wilson’s theorem and Lemma 4.3 we obtain

$$\begin{aligned} H_p(kp^2)&= H_p((k-1)p^2+(p-1)p+p-1)\\&\quad +(kp^2-1)_{(p-1)}H_p((k-1)p^2+(p-1)p)\\&\equiv H_p((k-1)p^2+(p-1)p+p-1)\\&\quad +(p-1)!H_p((k-1)p^2+(p-1)p)\\&\equiv H_p((k-1)p^2+(p-1)p)+\sum _{t=1}^{p-1} (-1)^t(p-1)_{(t)}p^tH_p((k-1)p^2\\&\quad +(p-1-t)p)\sum _{1\le l_t\le \cdots \le l_1\le p-1}\frac{1}{l_1\cdots l_t}\\&\quad - H_p((k-1)p^2+(p-1)p)\\&\equiv (-1)^{p-1}\cdot (-1)p^{p-1}H_p((k-1)p^2)\equiv -p^{p-1}(-1)^{k-1}p^{(k-1)(p-1)}\\&=(-1)^kp^{k(p-1)}\pmod {p^{k(p-1)+1}}. \end{aligned}$$

Assume now that \(n=kp^2+jp\) for \(k\in \mathbb {N}\) and \(j\in \{1,\ldots ,p-1\}\). By the recurrence (1), induction hypothesis for \(n=kp^2+(j-1)p+p-1\), Lemma 4.3 and Wilson’s theorem we have

$$\begin{aligned} H_p(kp^2+jp)&=H_p(kp^2+(j-1)p+p-1)\\&\quad +(kp^2+(j-1)p+p-1)_{(p-1)}H_p(kp^2+(j-1)p)\\&\equiv H_p(kp^2+(j-1)p)\\&\quad +\sum _{t=1}^{j-1} (-1)^t(j-1)_{(t)}p^tH_p(kp^2+(j-1-t)p)\\&\quad \sum _{1\le l_t\le \cdots \le l_1\le p-1}\frac{1}{l_1\cdots l_t}+ (p-1)!H_p(kp^2+(j-1)p)\\&\equiv H_p(kp^2+(j-1)p)-H_p(kp^2+(j-1)p)\\&=0\pmod {p^{k(p-1)+j}}, \end{aligned}$$

since \(p^{k(p-1)+j-1-t}\mid H_p(kp^2+(j-1-t)p)\).

At this moment we assume that \(n=kp^2+jp+i\) for \(k\in \mathbb {N}\) and \(i,j\in \{0,\ldots ,p-1\}\). If \(i=0\), then the third congruence obviously is true. For \(i>0\), by (1), induction hypothesis for \(n=kp^2+jp+i-1\) and Wilson’s theorem we have

$$\begin{aligned} H_p(kp^2+jp+i)&=H_p(kp^2+jp+i-1)\\&\quad +(kp^2+jp+i-1)_{(p-1)}H_p(kp^2+(j-1)p+i)\\&\equiv H_p(kp^2+jp+i-1){+}\frac{jp\cdot (p-1)!}{i}H_p(kp^2+(j-1)p{+}i)\\&\equiv H_p(kp^2+jp+i-1)-\frac{jp}{i}H_p(kp^2+(j-1)p+i)\\&\equiv H_p(kp^2+jp)+\sum _{t=1}^j (-1)^t(j)_{(t)}p^tH_p(kp^2+(j-t)p)\\&\quad \sum _{1\le l_t\le \cdots \le l_1\le i-1}\frac{1}{l_1\cdots l_t}-\frac{pj}{i}H_p(kp^2+(j-1)p)\\&\quad +\sum _{t=1}^{j-1} (-1)^{t+1}(j)_{(t+1)}p^{t+1}H_p(kp^2+(j-1-t)p)\\&\quad \sum _{1\le l_t\le \cdots \le l_1\le i}\frac{1}{l_1\cdots l_t\cdot i}\\&\equiv H_p(kp^2+jp)+\sum _{t=1}^j (-1)^t(j)_{(t)}p^tH_p(kp^2+(j-t)p)\\&\quad \sum _{1\le l_t\le \cdots \le l_1\le i}\frac{1}{l_1\cdots l_t}\pmod {p^{k(p-1)+j+1}}. \end{aligned}$$

\(\square \)

We are ready to prove the lower bound for the p-adic valuation of \(H_p(n)\).

Corollary 4.5

For odd prime number p, non-negative integer k and integers \(i,j\in \{0,1,\ldots ,p-1\}\) we have \(\nu _p(H_p(kp^2+jp+i))\ge k(p-1)+j\), where the inequality is in fact equality for \(j=0\). In other words,

$$\begin{aligned} \nu _p(H_p(n))\ge \left\lfloor \frac{n}{p^2}\right\rfloor \cdot (p-1)+\left( \left\lfloor \frac{n}{p}\right\rfloor \pmod {p}\right) \end{aligned}$$

for all \(n\in \mathbb {N}\).

Proof

We only need to prove that \(\nu _p(H_p(kp^2+jp+i))=k(p-1)+j\) for \(j=0\). We proceed by induction on \(i\in \{0,\ldots ,p-1\}\). The equality \(\nu _p(H_p(kp^2+i))=k(p-1)\) holds for \(i=0\) by Theorem 4.4. If \(i>0\), then we write

$$\begin{aligned} H_p(kp^2+i)= & {} H_p(kp^2+i-1)+(kp^2+i-1)_{(p-1)}H_p((k-1)p^2\\&+(p-1)p+i). \end{aligned}$$

Then \(\nu _p((kp^2+i-1)_{(p-1)})\ge 2\), since \(kp^2\) appears as a factor in \((kp^2+i-1)_{(p-1)}\). We know that \(\nu _p(H_p((k-1)p^2+(p-1)p+i))\ge (k-1)(p-1)+(p-1)=k(p-1)\). Thus the summand \((kp^2+i-1)_{(p-1)}H_p((k-1)p^2+(p-1)p+i)\) has the p-adic valuation at least \(k(p-1)+2\) while, by induction hypothesis \(\nu _p(H_p(kp^2+i-1))=k(p-1)\). Hence, we get \(\nu _p(H_p(kp^2+i))=k(p-1)\). \(\square \)

Now we give the proofs of the main results of this section.

Proof of Theorem 4.1

Let us define \(\gamma _n=\left\lfloor \frac{n}{p^2}\right\rfloor \cdot (p-1)+\left( \left\lfloor \frac{n}{p}\right\rfloor \pmod {p}\right) \) for simplicity of notation. At first, we show that

$$\begin{aligned} \frac{H_p(n+p^2)}{p^{\gamma _{n+p^2}}}\equiv -\frac{H_p(n)}{p^{\gamma _n}}\pmod {p} \end{aligned}$$
(9)

for each \(n\in \mathbb {N}\). We write \(n=kp^2+jp+i\), \(k\in \mathbb {N}\), \(i,j\in \{0,1,\ldots ,p-1\}\), and proceed by induction on \(jp+i\). By Theorem 4.4 we see that the congruence (9) is satisfied for \(jp+i=0\). If \(jp+i>0\) and \(i>0\) then

$$\begin{aligned} \frac{H_p((k+1)p^2+jp+i)}{p^{\gamma _{(k+1)p^2+jp+i}}}&=\frac{H_p((k+1)p^2+jp+i)}{p^{(k+1)(p-1)+j}}\\&\equiv \frac{H_p((k{+}1)p^2{+}jp)}{p^{(k{+}1)(p-1){+}j}}\\&\quad +\sum _{t=1}^j (-1)^t(j)_{(t)}\frac{H_p((k+1)p^2+(j-t)p)}{p^{(k+1)(p-1)+j-t}}\\&\quad \sum _{1\le l_t\le \cdots \le l_1\le i}\frac{1}{l_1\cdots l_t}\\&\equiv -\frac{H_p(kp^2+jp)}{p^{k(p-1)+j}}-\sum _{t{=}1}^j (-1)^t(j)_{(t)}\frac{H_p(kp^2{+}(j-t)p)}{p^{k(p-1)+j-t}}\\&\quad \sum _{1\le l_t\le \cdots \le l_1\le i}\frac{1}{l_1\cdots l_t}\equiv -\frac{H_p(kp^2+jp+i)}{p^{k(p-1)+j}}\\&=-\frac{H_p(kp^2+jp+i)}{p^{\gamma _{kp^2+jp+i}}}\pmod {p}. \end{aligned}$$

If \(jp+i>0\) and \(i=0\) then we perform similar computations as in the proof of Theorem 4.4.

$$\begin{aligned} \frac{H_p((k+1)p^2+jp)}{p^{\gamma _{(k+1)p^2+jp}}}&=\frac{H_p((k+1)p^2+jp)}{p^{(k+1)(p-1)+j}}\\&\equiv \frac{H_p((k+1)p^2+(j-1)p)}{p^{(k+1)(p-1)+j}}\\&\quad +\sum _{t=1}^{j-1} (-1)^t(j-1)_{(t)}\frac{H_p((k+1)p^2+(j-1-t)p)}{p^{(k+1)(p-1)+j-1-t}}\cdot \frac{1}{p}\\&\quad \sum _{1\le l_t\le \cdots \le l_1\le p-1}\frac{1}{l_1\cdots l_t}\\&\quad +\frac{(p-1)!H_p((k+1)p^2+(j-1)p)}{p^{(k+1)(p-1)+j}}\\&\equiv \frac{1+(p-1)!}{p}\frac{H_p((k+1)p^2+(j-1)p)}{p^{(k+1)(p-1)+j-1}}\\&\quad +\sum _{t=1}^{j-1} (-1)^t(j-1)_{(t)}\frac{H_p((k+1)p^2+(j-1-t)p)}{p^{(k+1)(p-1)+j-1-t}}\cdot \frac{1}{p}\\&\quad \sum _{1\le l_t\le \cdots \le l_1\le p-1}\frac{1}{l_1\cdots l_t}\\&\equiv -\frac{1+(p-1)!}{p}\frac{H_p(kp^2+(j-1)p)}{p^{k(p-1)+j-1}}\\&\quad -\sum _{t=1}^{j-1} (-1)^t(j-1)_{(t)}\frac{H_p(kp^2+(j-1-t)p)}{p^{k(p-1)+j-1-t}}\cdot \frac{1}{p}\\&\quad \sum _{1\le l_t\le \cdots \le l_1\le p-1}\frac{1}{l_1\cdots l_t}\equiv -\frac{H_p(kp^2+jp)}{p^{k(p-1)+j}}\\&=-\frac{H_p(kp^2+jp)}{p^{\gamma _{kp^2+jp}}}\pmod {p}. \end{aligned}$$

We are left with proving that \(p^2\) is a basic period of the sequence \(\left( (-1)^{\left\lfloor \frac{n}{p^2}\right\rfloor }\frac{H_p(n)}{p^{\gamma _n}}\pmod {p}\right) _{n\in \mathbb {N}}\). It suffices to show that p is not a period of the sequence \(\left( (-1)^{\left\lfloor \frac{n}{p^2}\right\rfloor }\frac{H_p(n)}{p^{\gamma _n}}\pmod {p}\right) _{n\in \mathbb {N}}\). In order to do this, we assume the contrary. In particular, we have \(\frac{H_p(p+1)}{p}\equiv H_p(1)=1\pmod {p}\). Using recurrence relation for numbers \(H_p(n)\) we obtain the congruences

$$\begin{aligned} \frac{H_p(p)+(p)_{(p-1)}H_p(1)}{p}\equiv 1\pmod {p} \end{aligned}$$

or equivalently

$$\begin{aligned} \frac{H_p(p)}{p}+(p-1)_{(p-2)}H_p(1)\equiv 1\pmod {p}. \end{aligned}$$

Since p is a period of the sequence \(\left( (-1)^{\left\lfloor \frac{n}{p^2}\right\rfloor }\frac{H_p(n)}{p^{\gamma _n}}\pmod {p}\right) _{n\in \mathbb {N}}\), we thus have \(\frac{H_p(p)}{p}\equiv H_p(0)=1\pmod {p}\). Hence,

$$\begin{aligned} 1+(p-1)_{(p-2)}H_p(1)\equiv 1\pmod {p}, \end{aligned}$$

which means that

$$\begin{aligned} (p-1)_{(p-2)}\equiv 0\pmod {p}. \end{aligned}$$

However, the number \((p-1)_{(p-2)}\) is not divisible by p. A contradiction shows that p is not a period of the sequence \(\left( (-1)^{\left\lfloor \frac{n}{p^2}\right\rfloor }\frac{H_p(n)}{p^{\gamma _n}}\pmod {p}\right) _{n\in \mathbb {N}}\).

The sequence \(\left( \frac{H_p(n)}{p^{\gamma _n}}\pmod {p}\right) _{n\in \mathbb {N}}\) is thus periodic with period \(2p^2\). We know, that \(p^2\) is not a period of this sequence, as \(\frac{H_p(kp^2)}{p^{k(p-1)}}\equiv (-1)^k\pmod {p}\). The number 2 also cannot be a period of this sequence. If we assume the contrary then, since \(H_p(0)\equiv H_p(1)\equiv 1\pmod {p}\), we have \(\frac{H_p(n)}{p^{\gamma _n}}\equiv 1\pmod {p}\). This stays in contradiction with the fact, that \(\frac{H_p(p^2)}{p^{p-1}}\equiv -1\pmod {p}\). It suffices to show that 2p is not a period of the sequence \(\left( \frac{H_p(n)}{p^{\gamma _n}}\pmod {p}\right) _{n\in \mathbb {N}}\). In order to do this, we assume the contrary. In particular, we have \(\frac{H_p(2p+1)}{p^2}\equiv H_p(1)=1\pmod {p}\) and \(\frac{H_p(2p+2)}{p^2}\equiv H_p(2)=1\pmod {p}\). Using recurrence relation for numbers \(H_p(n)\) we obtain the congruences

$$\begin{aligned} \frac{H_p(2p)+(2p)_{(p-1)}H_p(p+1)}{p^2}&\equiv 1\pmod {p},\\ \frac{H_p(2p+1)+(2p+1)_{(p-1)}H_p(p+2)}{p^2}&\equiv 1\pmod {p}, \end{aligned}$$

or equivalently,

$$\begin{aligned} \frac{H_p(2p)}{p^2}+\frac{2(2p-1)_{(p-2)}H_p(p+1)}{p}&\equiv 1\pmod {p},\\ \frac{H_p(2p+1)}{p^2}+\frac{2(2p+1)(2p-1)_{(p-3)}H_p(p+2)}{p}&\equiv 1\pmod {p}. \end{aligned}$$

Since 2p is a period of the sequence \(\left( \frac{H_p(n)}{p^{\gamma _n}}\pmod {p}\right) _{n\in \mathbb {N}}\), we thus have \(\frac{H_p(2p)}{p^2}\equiv H_p(0)=1\pmod {p}\) and \(\frac{H_p(2p+1)}{p^2}\equiv H_p(1)=1\pmod {p}\). Hence,

$$\begin{aligned} 1+\frac{2(2p-1)_{(p-2)}H_p(p+1)}{p}&\equiv 1\pmod {p},\\ 1+\frac{2(2p+1)(2p-1)_{(p-3)}H_p(p+2)}{p}&\equiv 1\pmod {p}, \end{aligned}$$

which means that

$$\begin{aligned} \frac{2(2p-1)_{(p-2)}H_p(p+1)}{p}&\equiv 0\pmod {p},\\ \frac{2(2p+1)(2p-1)_{(p-3)}H_p(p+2)}{p}&\equiv 0\pmod {p}. \end{aligned}$$

The numbers \(2(2p-1)_{(p-2)}\) and \(2(2p+1)(2p-1)_{(p-3)}\) are both not divisible by p. Hence, the numbers \(H_p(p+1)\) and \(H_p(p+2)\) are divisible by \(p^2\). On the other hand, \(H_p(p+2)=H_p(p+1)+(p+1)_{(p-1)}H_p(2)=H_p(p+1)+(p+1)p(p-1)_{(p-3)}\). The number \((p+1)p(p-1)_{(p-3)}\) is not divisible by \(p^2\). This is why the numbers \(H_p(p+1)\) and \(H_p(p+2)\) cannot be both divisible by \(p^2\). A contradiction shows that p is not a period of the sequence \(\left( \frac{H_p(n)}{p^{\gamma _n}}\pmod {p}\right) _{n\in \mathbb {N}}\). \(\square \)

Proof of Proposition 4.2

If \(p=2\), then the result is well known (see for example [1, Theorem 4.1]). From Corollary 4.5 we know that \(\nu _p(H_p(p-1))=0\). Hence we put \(b_0=p-1\). Let us fix \(j\in \{1,\ldots ,p-1\}\) and assume by induction hypothesis that we have \(b_{j-1}\in \{p-j,\ldots ,p-1\}\) satisfies the equality \(\nu _p(H_p((j-1)p+b_{j-1}))=j-1\). By Corollary 4.5 we have \(\nu _p(H_p(jp+b_{j-1}-1))\ge j\) and \(\nu _p(H_p(jp+b_{j-1}))\ge j\). Moreover, \(\nu _p((jp+b_{j-1}-1)_{(p-1)})=1\). By the equality

$$\begin{aligned} H_p(jp+b_{j-1})= & {} H_p(jp+b_{j-1}-1)\\&+(jp+b_{j-1}-1)_{(p-1)}H_p((j-1)p+b_{j-1}), \end{aligned}$$

since \(\nu _p((jp+b_{j-1}-1)_{(p-1)}H_p((j-1)p+b_{j-1}))=j\), we infer that at least one of the numbers \(H_p(jp+b_{j-1})\), \(H_p(jp+b_{j-1}-1)\) has the p-adic valuation equal to j. We thus take \(b_j\) as one of the values \(b_{j-1}-1\), \(b_{j-1}\) such that \(\nu _p(H_p(jp+b_j))=j\). In particular, \(b_j\ge p-j-1\). At last, we use Theorem 4.1 to obtain

$$\begin{aligned} (-1)^k\frac{H_p(kp^2+jp+b_j)}{p^{k(p-1)+j}}\equiv \frac{H_p(jp+b_j)}{p^j}\not \equiv 0\pmod {p}, \end{aligned}$$

since \(\nu _p(H_p(jp+b_j))=j\). Hence \(\nu _p(H_p(kp^2+jp+b_j))=k(p-1)+j\) for each \(k\in \mathbb {N}\). \(\square \)

In Theorem 4.1 we proved periodicity of the sequence \((H_{p}(n)/p^{\gamma _{p}(n)})_{n\in \mathbb {N}}\), where

$$\begin{aligned} \gamma _{p}(n)=\left\lfloor \frac{n}{p^2}\right\rfloor \cdot (p-1)+\left( \left\lfloor \frac{n}{p}\right\rfloor \pmod {p}\right) . \end{aligned}$$

In general, we ask the following.

Question 4.6

For which \(p\in {\mathbb {P}}\) and \(w\in \mathbb {N}_+\) the sequence

$$\begin{aligned} \left( \frac{H_{p}(n)}{p^{\nu _{p}(H_{p}(n))}}\pmod {p^w}\right) _{n\in \mathbb {N}} \end{aligned}$$

is periodic?

Theorem 4.7

For each prime number p and positive integer w the sequence

$$\begin{aligned} \left( \frac{H_{p}(n)}{p^{\left\lfloor \frac{n}{p^2}\right\rfloor (p-1)}}\pmod {p^w}\right) _{n\in \mathbb {N}} \end{aligned}$$

is periodic with period \(p^{2w+1}(p-1)\).

Proof

By [6, Theorem B] we know that there exist power series \(\lambda , f_r\in \mathbb {Z}_p[[x]]\), \(r\in \{0,\ldots ,p^2-1\}\), convergent on \(\mathbb {Z}_p\) such that \(H_p(kp^2+r)=p^{k(p-1)}f_r(k)\prod _{l=1}^k\lambda (l)\) for each \(k\in \mathbb {N}\) and \(\nu _p(H_p(kp^2+r))=k(p-1)+\nu _p(f_r(k))\). Let us take any \(n\in \mathbb {N}\) and write \(n=kp^2+r\) for some \(k\in \mathbb {N}\) and \(r\in \{0,\ldots ,p^2-1\}\). Then, by the above fact we have the following chain of congruences for any \(t\in \mathbb {N}\):

$$\begin{aligned} \frac{H_{p}(n+tp^{2w+1}(p-1))}{p^{\left\lfloor \frac{n+tp^{2w+1}(p-1)}{p^2}\right\rfloor (p-1)}}&=\frac{H_{p}((k+tp^{2w-1}(p-1))p^2+r)}{p^{(k+tp^{2w-1}(p-1))(p-1)}}\\&=f_r(k+tp^{2w-1}(p-1))\prod _{l=1}^{k+tp^{2w-1}(p-1)}\lambda (l)\\&\equiv f_r(k+tp^{2w-1}(p-1))\prod _{l=1}^{p^w}\lambda (l)^{\left\lceil \frac{k+tp^{2w-1}(p-1)-l+1}{p^w}\right\rceil }\\&\equiv f_r(k)\prod _{l=1}^{p^w}\lambda (l)^{\left\lceil \frac{k-l+1}{p^w}\right\rceil +tp^{w-1}(p-1)}\\&\equiv f_r(k)\prod _{l=1}^{p^w}\lambda (l)^{\left\lceil \frac{k-l+1}{p^w}\right\rceil }\equiv f_r(k)\prod _{l=1}^{k}\lambda (l)=\frac{H_p(kp^2+r)}{p^{k(p-1)}}\\&=\frac{H_{p}(n)}{p^{\left\lfloor \frac{n}{p^2}\right\rfloor (p-1)}}\pmod {p^w}, \end{aligned}$$

where we use Euler’s theorem as \(p\not \mid \lambda (l)\) for any \(l\in \mathbb {N}\). \(\square \)

Let us define a particular subset of the set of prime numbers:

$$\begin{aligned} \mathcal {A}&=\{p\in {\mathbb {P}}: \exists _{\alpha _p(p),\ldots ,\alpha _{p^2-1}(p)\in \mathbb {N}_+}\forall _{r\in \{p,\ldots ,p^2-1\}}\forall _{k\in \mathbb {N}} \nu _p(H_p(kp^2+r))\\&=k(p-1)+\alpha _r(p)\}. \end{aligned}$$

Then we are able to give a partial answer to Question 4.6.

Corollary 4.8

If \(p\in \mathcal {A}\) then for each \(w\in \mathbb {N}_+\) the sequence \(\left( \frac{H_{p}(n)}{p^{\nu _{p}(H_{p}(n))}}\pmod {p^w}\right) _{n\in \mathbb {N}}\) is periodic with period \(p^{2w+2\alpha (p)+1}(p-1)\), where \(\alpha (p)=\max _{r\in \{p,\ldots ,p^2-1\}} \alpha _r(p)\)

Proof

By the previous theorem we have

$$\begin{aligned} \frac{H_{p}(n+tp^{2w+2\alpha (p)+1}(p-1))}{p^{\left\lfloor \frac{n+tp^{2w+2\alpha (p)+1}(p-1)}{p^2}\right\rfloor (p-1)}}\equiv \frac{H_{p}(n)}{p^{\left\lfloor \frac{n}{p^2}\right\rfloor (p-1)}}\pmod {p^{w+\alpha (p)}} \end{aligned}$$

for each \(t\in \mathbb {N}\). After division by \(p^{\alpha _r(p)}\), where \(r=n\pmod {p^2}\), we get

$$\begin{aligned} \frac{H_{p}(n+tp^{2w+2\alpha (p)+2})}{p^{\nu _{p}(H_{p}(n+tp^{2w+2\alpha (p)+2}))}}\equiv \frac{H_{p}(n)}{p^{\nu _{p}(H_{p}(n))}}\pmod {p^{w+\alpha (p)-\alpha _r(p)}}. \end{aligned}$$

Since \(\alpha (p)-\alpha _r(p)\ge 0\), we thus obtain

$$\begin{aligned} \frac{H_{p}(n+tp^{2w+2\alpha (p)+2})}{p^{\nu _{p}(H_{p}(n+tp^{2w+2\alpha (p)+2}))}}\equiv \frac{H_{p}(n)}{p^{\nu _{p}(H_{p}(n))}}\pmod {p^w}, \end{aligned}$$

as we wanted to prove. \(\square \)

Corollary 4.9

The sequence

$$\begin{aligned} \left( \frac{H_{2}(n)}{2^{\nu _{2}(H_{2}(n))}}\pmod {4}\right) _{n\in \mathbb {N}} \end{aligned}$$

is periodic of period 16.

Proof

Since \(2\in \mathcal {A}\) and \(\alpha (2)=2\) (see for example [1, Theorem 4.1]), by the previous corollary we know that the sequence \(\left( \frac{H_{2}(n)}{2^{\nu _{2}(H_{2}(n))}}\pmod {4}\right) _{n\in \mathbb {N}}\) is periodic with period \(2^9\). Hence it suffices to check the values \(\frac{H_{2}(n)}{2^{\nu _{2}(H_{2}(n))}}\) modulo 4 for \(n\in \{0,\ldots ,511\}\) one by one. \(\square \)

In case of \(p\not \in \mathcal {A}\) we predict that the sequence \(\left( \frac{H_{p}(n)}{p^{\nu _{p}(H_{p}(n))}}\pmod {p^w}\right) _{n\in \mathbb {N}}\) is not periodic for any \(w\in \mathbb {N}_+\) but proving this fact seems to be out of reach for us.

5 The behaviour of the p-adic valuation of \(H_d(n)\), where \(p>d\)

On the beginning of the paper we marked that if p is a prime number \(<d\), then \(\nu _p(H_d(n))=0\) for each \(n\in \mathbb {N}\). The problem of computation of the p-adic valuations of the numbers \(H_d(n)\) in case \(p=d\) was considered in the previous section and it was studied in several publications. In the opposition to this fact the question concerning the computation of the p-adic valuations of the numbers \(H_d(n)\), where \(p>d\), is almost unexplored. It was first considered by Amdeberhan and Moll [1]. According to results on periodicity of the sequence \((H_2(n)\pmod {c})_{n\in \mathbb {N}}\) they claimed that if p is an odd prime number not dividing the values \(H_2(n)\) for \(n\in \{0,\ldots ,p-1\}\), then \(\nu _p(H_d(n))=0\) for each \(n\in \mathbb {N}\). The situation is more complicated if p divides some of those values. It happens for \(p=5\). Based on numerical computations they stated a conjecture which equivalent version is as follows

Conjecture 5.1

If p is an odd prime number such that \(p\mid H_2(n)\) for some \(n\in \{0,\ldots p-1\}\) then for each \(k\in \mathbb {N}_+\) there exists a unique \(n_k\) modulo \(p^k\) such that \(p^k\mid H_2(n)\) if and only if \(n\equiv n_k\pmod {p^k}\).

The above conjecture is not true for two reasons. The first reason is that there exist prime numbers p and positive integers \(n_1\) such that \(\nu _p(H_2(n))=1\) for each \(n\equiv n_1\pmod {p}\), for example \((p,n_1)=(19,6)\). The second one is that for some prime numbers p, for example 59 and 61, there exist more than one value \(n_1\) modulo p such that \(p\mid H_2(n)\) for \(n\equiv n_1\pmod {p}\).

The aim of this section is to shed some light on the behaviour of \(\nu _{p}(H_{d}(n))\) in the case when \(p>d\).

We use the exact formula for the number \(H_d(n)\) and make some modifications:

$$\begin{aligned} H_d(n)=\sum _{k=0}^{\left\lfloor \frac{n}{d}\right\rfloor } \frac{n!}{(n-dk)!k!d^k}=\sum _{k=0}^{\left\lfloor \frac{n}{d}\right\rfloor } \frac{(n)_{(dk)}}{k!d^k}=\sum _{k=0}^{+\infty } \frac{(n)_{(dk)}}{k!d^k}. \end{aligned}$$

The above notation suggests us to define the function \(f_d(x)=\sum _{k=0}^{+\infty } \frac{(x)_{(dk)}}{k!d^k}\), \(x\in \mathbb {Z}_p\). This function is well defined for each \(x\in \mathbb {Z}_p\) as

$$\begin{aligned} \nu _p\left( \frac{(x)_{(dk)}}{k!d^k}\right) \ge \nu _p\left( \frac{(dk)!}{k!d^k}\right) =\nu _p\left( \frac{(dk)!}{k!}\right) =\nu _p((dk)_{((d-1)k)})\ge \nu _p(((d-1)k)!), \end{aligned}$$

where the last value in the above inequalities tend to \(+\infty \) when \(k\rightarrow +\infty \). The following three lemmas show that

  • \(f_d\) is a p-adic differentiable function,

  • there exists a function \(g_d:\mathbb {Z}_p\times p\mathbb {Z}_p\rightarrow \mathbb {Q}_p\) such that \(f_d(x+h)=f_d(x)+hf'_d(x)+h^2g_d(x,h)\) for any \(x\in \mathbb {Z}_p\), \(h\in p\mathbb {Z}_p\) and \(g_d(x,h)\in \mathbb {Z}_p\) if only \(d\ge 3\) or \(p\mid f_2(x)\),

  • \(f'_d(x_1)\equiv f'_d(x_2)\pmod {p^r}\) if \(x_1\equiv x_2\pmod {p^r}\).

By the above facts we will be able to describe behaviour of the p-adic valuations of numbers \(H_d(n)\), \(n\in \mathbb {N}\), using classical Hensel’s lemma.

Lemma 5.2

The function \(f_d\) is differentiable and \(f'_d(x)=\sum _{k=1}^{+\infty }\sum _{j=0}^{dk-1} \frac{(x)_{(j)}(x-j-1)_{(dk-j-1)}}{k!d^k}\in \mathbb {Z}_p\) for each \(x\in \mathbb {Z}_p\).

Proof

We compute the derivative from the very definition:

$$\begin{aligned} f'_d(x)&=\lim _{h\rightarrow 0}\frac{f_d(x+h)-f_d(x)}{h}=\lim _{h\rightarrow 0}\frac{1}{h}\left( \sum _{k=0}^{+\infty } \frac{(x+h)_{(dk)}}{k!d^k}-\sum _{k=0}^{+\infty } \frac{(x)_{(dk)}}{k!d^k}\right) \\&=\lim _{h\rightarrow 0}\frac{1}{h}\sum _{k=0}^{+\infty } \frac{(x+h)_{(dk)}-(x)_{(dk)}}{k!d^k}\\&=\lim _{h\rightarrow 0}\frac{1}{h}\sum _{k=0}^{+\infty } \frac{1}{k!d^k}\left[ \left( \sum _{t=0}^{dk}h^t\sum _{0\le j_1<\cdots<j_t\le dk-1}\frac{(x)_{(dk)}}{(x-j_1)\cdots (x-j_t)}\right) -(x)_{(dk)}\right] \\&=\lim _{h\rightarrow 0}\frac{1}{h}\sum _{k=1}^{+\infty } \frac{1}{k!d^k}\sum _{t=1}^{dk}h^t\sum _{0\le j_1<\cdots<j_t\le dk-1}\frac{(x)_{(dk)}}{(x-j_1)\cdots (x-j_t)}\\&=\lim _{h\rightarrow 0}\sum _{k=1}^{+\infty } \frac{1}{k!d^k}\sum _{t=1}^{dk}h^{t-1}\sum _{0\le j_1<\cdots<j_t\le dk-1}\frac{(x)_{(dk)}}{(x-j_1)\cdots (x-j_t)}\\&=\lim _{h\rightarrow 0}\sum _{k=1}^{+\infty } \frac{1}{k!d^k}\left( \sum _{j=0}^{dk-1}\frac{(x)_{(dk)}}{x-j}+h\sum _{t=2}^{dk}h^{t-2}\sum _{0\le j_1<\cdots<j_t\le dk-1}\frac{(x)_{(dk)}}{(x-j_1)\cdots (x-j_t)}\right) \\&=\sum _{j=0}^{dk-1}\frac{(x)_{(dk)}}{k!d^k(x-j)}+\lim _{h\rightarrow 0}\sum _{k=1}^{+\infty } \sum _{k=1}^{+\infty } h\sum _{t=2}^{dk}h^{t-2}\\&\quad \sum _{0\le j_1<\cdots <j_t\le dk-1}\frac{(x)_{(dk)}}{k!d^k(x-j_1)\cdots (x-j_t)}, \end{aligned}$$

where we put \(\sum _{0\le j_1<\cdots <j_t\le dk-1}\frac{(x)_{(dk)}}{(x-j_1)\cdots (x-j_t)}=(x)_{(dk)}\) for \(t=0\). We estimate the p-adic valuation of \(\frac{h^{t-2}(x)_{(dk)}}{k!d^k(x-j_1)\cdots (x-j_t)}\) from below. We will do this by estimating the p-adic valuation of the product \((x-j_1)\cdots (x-j_{dk-l})\), where \(0\le j_1<\cdots <j_{dk-l}\le dk-1\), from below by the number of factors \(x-j_1, \ldots , x-j_{dk-l}\) divisible by p. This number is at least equal to \(\left\lfloor \frac{dk}{p}\right\rfloor -l\). Indeed, we have at least \(\left\lfloor \frac{dk}{p}\right\rfloor \) numbers divisible by p among all the p-adic integers \(x-dk+1, x-dk+2, \ldots , x\) and we cancel at most l numbers divisible by p from them. Hence,

$$\begin{aligned} \nu _p \left( \frac{h^{t-2}(x)_{(dk)}}{k!d^k(x-j_1)\cdots (x-j_t)}\right)&\ge (t-2)\nu _p(h)+\left\lfloor \frac{dk}{p}\right\rfloor -t-\frac{k-s_p(k)}{p-1}\\&>t-2+\frac{dk}{p}-1-t-\frac{k}{p-1}\\&=\frac{(p-1)dk-pk}{p(p-1)}-3=\frac{[(p-1)(d-1)-1]k}{p(p-1)}-3\\&\ge \frac{[2\cdot 1-1]k}{p(p-1)}-3=\frac{k}{p(p-1)}-3, \end{aligned}$$

where we assumed that \(\nu _p(h)\ge 1\) and use the Legendre formula \(\nu _p(k!)=\frac{k-s_p(k)}{p-1}\). Here, \(s_p(k)\) is the sum of digits of the number k written in the (unique) p-ary expansion. Hence, the p-adic valuation of

$$\begin{aligned} \sum _{t=2}^{dk}h^{t-2}\sum _{0\le j_1<\cdots <j_t\le dk-1}\frac{(x)_{(dk)}}{k!d^k(x-j_1)\cdots (x-j_t)} \end{aligned}$$

is at least \(-2\) and it tends to \(+\infty \) when \(k\rightarrow +\infty \). Thus, the series

$$\begin{aligned} \sum _{k=1}^{+\infty } \sum _{t=2}^{dk}h^{t-2}\sum _{0\le j_1<\cdots <j_t\le dk-1}\frac{(x)_{(dk)}}{k!d^k(x-j_1)\cdots (x-j_t)} \end{aligned}$$

is convergent and its p-adic valuation is at least \(-2\). We infer that

$$\begin{aligned}&\nu _p\left( \sum _{k=1}^{+\infty } h\sum _{t=2}^{dk}h^{t-2}\sum _{0\le j_1<\cdots<j_t\le dk-1}\frac{(x)_{(dk)}}{k!d^k(x-j_1)\cdots (x-j_t)}\right) \\&\quad =\nu _p(h)+\nu _p\left( \sum _{k=2}^{+\infty } \sum _{t=2}^{dk}h^{t-2}\sum _{0\le j_1<\cdots <j_t\le dk-1}\frac{(x)_{(dk)}}{k!d^k(x-j_1)\cdots (x-j_t)}\right) \rightarrow +\infty \end{aligned}$$

when \(h\rightarrow 0\). This is why \(f'_d(x)=\sum _{k=1}^{+\infty } \sum _{j=0}^{dk-1}\frac{(x)_{(dk)}}{k!d^k(x-j)}=\sum _{k=1}^{+\infty }\sum _{j=0}^{dk-1} \frac{(x)_{(j)}(x-j-1)_{(dk-j-1)}}{k!d^k}\). This series is convergent, as

$$\begin{aligned} \nu _p\left( \frac{(x)_{(j)}(x-j-1)_{(dk-j-1)}}{k!d^k}\right)&=\nu _p\left( {x\atopwithdelims ()j}{x-j-1\atopwithdelims ()dk-j-1}\frac{j!(dk-j-1)!}{k!d^k}\right) \\&\ge \frac{j-s_p(j)+dk-j-1-s_p(dk-j-1)-k+s_p(k)}{p-1}\\&\ge \frac{(d-1)k-1}{p-1}-2\log _p dk-2\rightarrow +\infty \end{aligned}$$

when \(k\rightarrow +\infty \), where we used the fact that \(j,dk-j-1<dk\), so \(j,dk-j-1\) have at most \(\lfloor \log _p dk\rfloor +1\)p-ary digits. Moreover,

$$\begin{aligned}&\nu _p\left( \frac{(x)_{(j)}(x-j-1)_{(dk-j-1)}}{k!d^k}\right) =\nu _p\left( {x\atopwithdelims ()j}{x-j-1\atopwithdelims ()dk-j-1}\frac{j!(dk-j-1)!}{k!d^k}\right) \ge 0, \end{aligned}$$

as at least one of the numbers \(j,dk-j-1\) is greater than or equal to k. Thus the p-adic valuation of \(\sum _{k=1}^{+\infty }\sum _{j=0}^{dk-1} \frac{(x)_{(j)}(x-j-1)_{(dk-j-1)}}{k!d^k}\) is non-negative. \(\square \)

Lemma 5.3

For each \(x,h\in \mathbb {Z}_p\) with \(\nu _p(h)\ge 1\) we have \(f_d(x+h)=f_d(x)+hf'_d(x)+h^2g_d(x,h)\), where \(g_d(x,h)=\sum _{l=2}^{+\infty }x^{l-2}\sum _{k=\left\lceil \frac{l}{d}\right\rceil }^{+\infty }\frac{1}{k!d^k}\sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l})\). Moreover, if \(d\ge 3\) or \(\nu _p(f_2(x))\ge 1\), then \(g_d(x,h)\in \mathbb {Z}_p\).

Proof

Let us fix \(x,h\in \mathbb {Z}_p\) with \(\nu _p(h)\ge 1\). We then have:

$$\begin{aligned} \begin{aligned} f_d(x+h)&=\sum _{k=0}^{+\infty } \frac{(x+h)_{(dk)}}{k!d^k}=\sum _{k=0}^{+\infty }\frac{1}{k!d^k}\sum _{l=0}^{dk}h^l\\&\quad \sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l}). \end{aligned} \end{aligned}$$
(10)

For the change of the order of summation, we will show that

$$\begin{aligned} \lim _{k\rightarrow +\infty } \nu _p\left( \frac{h^l\sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l})}{k!d^k}\right) =+\infty . \end{aligned}$$

Let us estimate the p-adic valuation of the number \(\sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l})\) from below. We have the inequality

$$\begin{aligned}&\nu _p\left( \frac{h^l\sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l})}{k!d^k}\right) \nonumber \\&\quad \ge l+\left\lfloor \frac{dk}{p}\right\rfloor -l-\frac{k-s_p(k)}{p-1}\nonumber \\&\quad =\left\lfloor \frac{dk}{p}\right\rfloor -\frac{k-s_p(k)}{p-1}=\left\lfloor \frac{dk}{p} -\frac{k-s_p(k)}{p-1}\right\rfloor =\left\lfloor \frac{(dp-d-p)k+ps_p(k)}{p(p-1)}\right\rfloor \nonumber \\&\quad =\left\lfloor \frac{[(d-1)(p-1)-1]k+ps_p(k)}{p(p-1)}\right\rfloor .\nonumber \\ \end{aligned}$$
(11)

Since \(p>d\ge 2\), we thus have

$$\begin{aligned} \lim _{k\rightarrow +\infty } \nu _p\left( \frac{h^l\sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l})}{k!d^k}\right) =+\infty . \end{aligned}$$

Then we change summation in the last expression in (10) and get the following:

$$\begin{aligned} f_d(x+h)&=\sum _{l=0}^{+\infty }h^l\sum _{k=\left\lceil \frac{l}{d}\right\rceil }^{+\infty }\frac{1}{k!d^k}\sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l})\\&=f_d(x)+hf'_d(x)+h^2g_d(x,h), \end{aligned}$$

where \(g_d(x,h)=\sum _{l=2}^{+\infty }h^{l-2}\sum _{k=\left\lceil \frac{l}{d}\right\rceil }^{+\infty }\frac{1}{k!d^k}\sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l})\). Now, we are left with the proof that \(\nu _p(g_d(x,h))\ge 0\) provided that \(\nu _p(f_d(x))\ge 1\) or \(d\ge 3\). If \(k<p\), where \(d\ge 2\) is arbitrary, then, of course, \(\nu _p\left( \frac{h^{l-2}\sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l})}{k!d^k}\right) \ge 0\). By (11) we know that

$$\begin{aligned}&\nu _p\left( \frac{h^{l-2}\sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l})}{k!d^k}\right) \\&\quad \ge \left\lfloor \frac{[(d-1)(p-1)-1]k+ps_p(k)}{p(p-1)}\right\rfloor -2. \end{aligned}$$

We check that \(\frac{[(d-1)(p-1)-1]k+ps_p(k)}{p(p-1)}-2\ge \frac{[2(p-1)-1](p+1)}{p(p-1)}-2=\frac{(2p-3)(p+1)}{p(p-1)}-2\ge 0\) for \(p>d\ge 3\) and \(k\ge p+1\). If \(d\ge 3\) and \(k=p\), then either \(l\ge 3\) and then \(\nu _p(h^{l-2})\ge l-2\ge 1=\nu _p(p!)\) or \(l=2\) and then in each product of the form \((x-j_1)\cdots (x-j_{dk-2})\), where \(0\le j_1<\cdots <j_{dk-2}\le dk-1\), there is a factor with the p-adic valuation at least equal to 1. Hence, \(\nu _p\left( \frac{h^{l-2}\sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l})}{k!d^k}\right) \ge 0\) for \(d\ge 3\) and \(k=p\). If \(d=2\), then \(\frac{[(d-1)(p-1)-1]k+ps_p(k)}{p(p-1)}-2\ge \frac{[(p-1)-1](2p+4)}{p(p-1)}-2=\frac{(p-2)(2p+4)}{p(p-1)}-2\ge 0\) for \(p\ge 5\) and \(k\ge 2p+4\) (we do not need to consider the case of \(p=3\) as \(3\not \mid H_2(n)\) for any \(n\in \mathbb {N}\)). If \(d=2\), \(p\le k\le 2p-1\) and \(l\ge 3\), then \(\nu _p(h^{l-2})\ge l-2\ge 1=\nu _p(k!)\). Hence, \(\nu _p\left( \frac{h^{l-2}\sum _{0\le j_1<\cdots <j_{dk-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l})}{k!d^k}\right) \ge 0\) for \(d=2\), \(p\le k\le 2p-1\) and \(l\ge 3\). If \(d=2\) and \(2p\le k\le 2p+3\), where \(p\ge 5\), then either \(l\ge 4\) and then \(\nu _p(h^{l-2})\ge l-2\ge 2=\nu _p(k!)\) or \(l\in \{2,3\}\) and then in each product of the form \((x-j_1)\cdots (x-j_{2k-l})\), where \(0\le j_1<\cdots <j_{2k-l}\le 2k-1\) there are at least \(4-l\) factors with the p-adic valuation at least equal to 1. Hence, \(\nu _p(h^{l-2}\sum _{0\le j_1<\cdots <j_{2k-l}\le dk-1}(x-j_1)\cdots (x-j_{dk-l}))\ge l-2+4-l=2=\nu _p(k!)\). We left with the case of \(d=2\), \(p\le k\le 2p-1\) and \(l=2\). Let us assume that \(\nu _p(f_2(x))\ge 1\) and take \(r\in \{0,\ldots ,p-1\}\) such that \(r=x\pmod {p}\). We then compute modulo p:

$$\begin{aligned}&p\cdot \sum _{k=p}^{2p-1}\sum _{0\le j_1<\cdots<j_{2k-2}\le 2k-1} \frac{(x-j_1)\cdots (x-j_{2k-2})}{k!2^k}\\&\quad =\sum _{k=p}^{2p-1}\sum _{0\le j_1<\cdots <j_{2k-2}\le 2k-1} \frac{(x-j_1)\cdots (x-j_{2k-2})}{(k)_{(k-p)}(p-1)!2^k}\\&\quad \equiv -\sum _{k=p}^{2p-1} \frac{(x)_{(r)}(x-r-1)_{(p-1)}(x-r-p-1)_{(p-r-1)}(x-2p)_{(2(k-p))}}{(k-p)_{(k-p)}2^{k-p+1}}\\&\quad \equiv -\frac{1}{2}\sum _{k=p}^{2p-1} \frac{r!(p-1)!(p-1)_{(p-r-1)}(x)_{(2(k-p))}}{(k-p)_{(k-p)}2^{k-p}}=-\frac{1}{2}\sum _{k=0}^{p-1} \frac{((p-1)!)^2(x)_{(2k)}}{k!2^k}\\&\quad \equiv -\frac{1}{2}\sum _{k=0}^{+\infty } \frac{(x)_{(2k)}}{k!2^k}=f_2(x)\equiv 0\pmod {p}. \end{aligned}$$

The congruence in the fourth line holds because \(k_{(k-p)}\equiv (k-p)_{(k-p)}\pmod {p}\), \((p-1)!\equiv -1\pmod {p}\) by Wilson’s theorem, \(2^{p-1}\equiv 1\pmod {p}\) by Fermat’s little theorem and we can omit the summands \(\frac{(x-j_1)\cdots (x-j_{2k-2})}{(k)_{(k-p)}(p-1)!2^k}\) containing a factor divisible by p in the numerator. The congruence in the third line holds because \(x-r+j\equiv j\pmod {p}\) for \(j\in \{1,\ldots ,r\}\), \(x-r-p+j\equiv j\pmod {p}\) for \(j\in \{1,\ldots ,p-1\}\), \(x-r-p-j\equiv p-j\pmod {p}\) for \(j\in \{1,\ldots ,p-r-1\}\) and \(x-2p-j\equiv x-j\pmod {p}\) for \(j\in \{0,\ldots ,2(k-p)-1\}\). Thus,

$$\begin{aligned} \nu _p\left( \sum _{k=p}^{2p-1}\sum _{0\le j_1<\cdots <j_{2k-2}\le 2k-1} \frac{(x-j_1)\cdots (x-j_{2k-l})}{k!2^k}\right) \ge 0. \end{aligned}$$

This ends the proof of the fact that \(g_d(x,h)\in \mathbb {Z}_p\) on condition that \(\nu _p(f_d(x))\ge 1\) or \(d\ge 3\). \(\square \)

Lemma 5.4

Let \(x,h\in \mathbb {Z}_p\) with \(\nu _p(h)\ge 1\). If \(d\ge 3\) or \(\nu _p(f_2(x))\ge 1\), then \(f'_d(x+h)\equiv f'_d(x)\pmod {p^{\nu _p(h)}}\).

Proof

By the previous lemma we can write

$$\begin{aligned} f_d(x+h)=&f_d(x)+hf'_d(x)+h^2g_d(x,h),\\ f_d(x)=&f_d(x+h)-hf'_d(x+h)+h^2g_d(x+h,-h). \end{aligned}$$

After adding the above two equalities and simplifying we obtain

$$\begin{aligned} 0=h(f'_d(x)-f'_d(x+h))+h^2(g_d(x,h)+g_d(x+h,-h)). \end{aligned}$$

Since \(d\ge 3\) or \(\nu _p(f_2(x))\ge 1\), by the previous lemma we have that \(\nu _p(g_d(x,h)),\nu _p(g_d(x+h,-h))\ge 0\). Thus, \(p^{2\nu _p(h)}\mid h^2(g_d(x,h)+g_d(x+h,-h))\), which implies that \(p^{2\nu _p(h)}\mid h(f'_d(x)-f'_d(x+h))\). Hence, \(p^{\nu _p(h)}\mid f'_d(x)-f'_d(x+h)\), or equivalently, \(f'_d(x+h)\equiv f'_d(x)\pmod {p^{\nu _p(h)}}\). \(\square \)

At this moment we are prepared to state the theorem on qualitative description of the sequence \((\nu _p(H_d(n))_{n\in \mathbb {N}}\).

Theorem 5.5

Let d be a positive integer at least equal to 2, \(p>d\) be a prime number and k be a positive integer. Assume that \(H_d(n_k)\equiv 0 \pmod {p^k}\) for some integer \(n_k\). Then the number of solutions n modulo \(p^{k+1}\) of the congruence \(H_d(n)\equiv 0 \pmod {p^{k+1}}\), satisfying the condition \(n \equiv n_k \pmod {p^k}\), is equal to:

  • 1, when \(f'_d(n_k)\not \equiv 0 \pmod {p}\);

  • 0, when \(f'_d(n_k)\equiv 0 \pmod {p}\) and \(H_d(n_k)\not \equiv 0 \pmod {p^{k+1}}\);

  • p, when \(f'_d(n_k)\equiv 0 \pmod {p}\) and \(H_d(n_k)\equiv 0 \pmod {p^{k+1}}\).

In particular, if \(p\mid H_d(n_1)\) for some \(n_1\in \mathbb {N}\) and \(\nu _p(f'_d(n_1))=0\), then for each \(k\in \mathbb {N}_+\) there exists a unique value \(n_k\) modulo \(p^k\) such that if \(n\equiv n_1\pmod {p}\), then \(p^k\mid H_d(n)\) if and only if \(n\equiv n_k\pmod {p^k}\). In other words there exists a unique p-adic integer \(b\equiv n_1\pmod {p}\) such that \(\nu _p(H_d(n))=\nu _p(n-b)\) for each non-negative integer \(n\equiv n_1\pmod {p}\).

Proof

We have \(H_d(n)=f_d(n)\) for each \(n\in \mathbb {N}\). Moreover, we know that \(f_d(x+h)=f_d(x)+hf'_d(x)+h^2g_d(x,h)\) for \(x,h\in \mathbb {Z}_p\) with \(\nu _p(h)\ge 1\). Furthermore, if \(d\ge 3\) or \(\nu _p(f_2(x))\ge 1\), then \(g_d(x,h)\in \mathbb {Z}_p\) and \(f'_d(x_1)\equiv f'_d(x_2)\pmod {p}\) for congruent p-adic integers \(x_1, x_2\) modulo p. These all facts make the proof of our theorem exactly the same as the proof of classical Hensel’s lemma from [9, p. 44]. \(\square \)

Remark 5.6

Let us compute \(f'_d(n)\pmod {p}\) for \(n\in \mathbb {N}\):

$$\begin{aligned} f'_d(n)&= \sum _{k=1}^{+\infty }\sum _{j=0}^{dk-1} \frac{(n)_{(j)}(n-j-1)_{(dk-j-1)}}{k!d^k}\\&=\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }\sum _{j=0}^{dk-1} \frac{(n)_{(j)}(n-j-1)_{(dk-j-1)}}{k!d^k}\\&\quad +\sum _{k=\left\lfloor \frac{n}{d}\right\rfloor +1}^{+\infty } \frac{n!(-1)^{dk-n-1}(dk-n-1)!}{k!d^k}\\&\equiv \sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }\sum _{j=0}^{dk-1} \frac{(n)_{(j)}(n-j-1)_{(dk-j-1)}}{k!d^k}\\&\quad +\sum _{k=\left\lfloor \frac{n}{d}\right\rfloor +1}^{\left\lceil \frac{n+p+1}{d-1}\right\rceil -1} \frac{n!(-1)^{dk-n-1}(dk-n-1)!}{k!d^k}\pmod {p}, \end{aligned}$$

as \(\frac{(dk-n-1)!}{k!}={dk-n-1\atopwithdelims ()k}((d-1)k-n-1)!\) and \(p\mid ((d-1)k-n-1)!\) if \(p\le (d-1)k-n-1\). That is a way to compute the value \(f'_d(n)\pmod {p}\) by adding only finitely many summands.

However, in many cases, having \(d\in \mathbb {N}_{\ge 2}\), a prime number p and \(n_1\in \{d,\ldots ,p-1\}\) such that \(p\mid H_d(n_1)\) (recall that \(H_d(n)=1\) for \(n\in \{0,\ldots ,d-1\}\)), we do not need to compute \(f'_d(n)\pmod {p}\). Instead of this, it suffices to compute \(\nu _p(H_d(n_1))\). If \(\nu _p(H_d(n_1))=1\), then we check p-adic valuations of numbers \(H_d(n_1+pt)\) for \(t\in \{1,\ldots ,p-1\}\). If \(\nu _p(H_d(n_1+pt))\ge 2\) for some \(t\in \{1,\ldots ,p-1\}\) then for each \(k\in \mathbb {N}_+\) there exists a unique value \(n_k\) modulo \(p^k\) such that if \(n\equiv n_1\pmod {p}\) then \(p^k\mid H_d(n)\) if and only if \(n\equiv n_k\pmod {p^k}\). Otherwise, \(\nu _p(H_d(n))=1\) for any \(n\equiv n_1\pmod {p}\). If \(\nu _p(H_d(n_1))\ge 2\) then we only check p-adic valuation of the number \(H_d(n_1+p)\). If \(\nu _p(H_d(n_1+p))=1\) then for each \(k\in \mathbb {N}_+\) there exists a unique value \(n_k\) modulo \(p^k\) such that if \(n\equiv n_1\pmod {p}\) then \(p^k\mid H_d(n)\) if and only if \(n\equiv n_k\pmod {p^k}\). Otherwise, \(\nu _p(H_d(n))\ge 2\) for any \(n\equiv n_1\pmod {p}\).

Remark 5.7

We found all the triples \((d,p,n_1)\) for \(d\in \{2,3,4,5\}\), first 25 prime numbers p and numbers \(n_1\in \{d,\ldots ,p-1\}\) such that \(p\mid H_d(n_1)\). We checked the behaviour of the p-adic valuations of numbers \(H_d(n)\) where \(n\equiv n_1\pmod {p}\). The only triples \((d,p,n_1)\) such that \(\nu _p(H_d(n))=1\) for all \(n\equiv n_1\pmod {p}\) are (2, 19, 6), (3, 13, 7). For any other triple and a positive integer k we have the existence of a unique \(n_k\) modulo \(p^k\) such that if \(n\equiv n_1\pmod {p}\) then \(p^k\mid H_d(n)\) if and only if \(n\equiv n_k\pmod {p^k}\).

6 Properties of polynomials attained during differentiation the exponential generating function of the sequence \((H_d(n))_{n\in \mathbb {N}}\)

Let \(m\in \mathbb {N}\) and for m-th derivative of \(\mathcal {H}_d(x)\) we write \(\mathcal {H}_{d}^{(m)}(x)=W_{d,m}(x)\mathcal {H}_{d}(x)\). We have \(W_{d,0}(x)=1\) and due to the identity

$$\begin{aligned} \mathcal {H}_{d}^{(m+1)}(x)=(\mathcal {H}_{d}^{(m)}(x))'=W_{d,m}'(x)\mathcal {H}_{d}(x)+(1+x^{d-1})W_{d,m}(x)\mathcal {H}_{d}(x) \end{aligned}$$

we immediately deduce the recurrence relation

$$\begin{aligned} W_{d,m+1}(x)=W_{d,m}'(x)+(1+x^{d-1})W_{d,m}(x). \end{aligned}$$
(12)

We summarize the basic properties of the sequence \((W_{d,m}(x))_{m\in \mathbb {N}}\) in the following:

Theorem 6.1

The following properties hold:

  1. (1)

    \(W_{d,n}(x)\) is a unitary polynomial with non-negative integer coefficients and \({\text {deg}}W_{d,n}(x)=(d-1)n\);

  2. (2)

    \(W_{d,n}(0)=H_{d}(n)\);

  3. (3)

    For \(d\in \mathbb {N}_{\ge 2}\) and \(m\in \mathbb {N}\) let us write

    $$\begin{aligned} W_{d,m}(x)=\sum _{i=0}^{(d-1)m}A_{d}(i,m)x^{i}. \end{aligned}$$

    If \(d\in \mathbb {N}_{\ge 3}\) is an odd number then

    $$\begin{aligned} \frac{1}{n!}\sum _{k=0}^{n}\left( {\begin{array}{c}n\\ k\end{array}}\right) (-1)^{n-k}H_{d}(m+k)H_{d}(n-k)= {\left\{ \begin{array}{ll} \begin{array}{ll} A_{d}(n,m) &{}\quad \text{ for }\;n\le (d-1)m, \\ 0 &{}\quad \text{ for }\;n>(d-1)m \end{array}; \end{array}\right. } \end{aligned}$$
  4. (4)

    The exponential generating function for the sequence \((W_{d,n}(x))_{n\in \mathbb {N}}\) takes the form

    $$\begin{aligned} \mathcal {W}_{d}(x,t)=\sum _{n=0}^{\infty }\frac{W_{d,n}(x)}{n!}t^{n}=\mathcal {H}_{d}(t)e^{\frac{(t+x)^d-t^d-x^d}{d}}=e^{t+\frac{(t+x)^{d}-x^{d}}{d}}. \end{aligned}$$

Proof

  1. (1)

    This is clear. Because \(W_{d,0}(x)=1\) is a polynomial and on the right hand side of the recurrence \(W_{d,m}(x)=W_{d,m-1}'(x)+(1+x^{d-1})W_{d,m-1}(x)\), \(m\in \mathbb {N}_{+}\), we have only addition and multiplication then simple induction gives the result. Similarly simple induction shows the equality \({\text {deg}}W_{d,m}(x)=(d-1)m\).

  2. (2)

    Because \(\mathcal {H}_{d}(0)=1\) then \(\mathcal {H}_{d}^{(m)}(0)=W_{d,m}(0)\) and thus \(W_{d,m}(0)\) is just the coefficient near \(x^m/m!\) in the power series expansion of \(\mathcal {H}_{d}(x)\) in the neighborhood of the point \(x=0\). Hence we get the result.

  3. (3)

    The stated identity is a simple consequence of the definition of the sequence \((W_{d,m}(x))_{m\in \mathbb {N}}\). Indeed, in the case of odd d we have \(\mathcal {H}_{d}(x)^{-1}=\mathcal {H}_{d}(-x)\). Let us also note that

    $$\begin{aligned} \mathcal {H}_{d}^{(m)}(x)=\sum _{n=0}^{\infty }\frac{H_{d}(n+m)}{n!}x^{n}. \end{aligned}$$

    In consequence, from the identity

    $$\begin{aligned} \mathcal {H}_{d}^{(m)}(x)\mathcal {H}_{d}(x)^{-1}=\mathcal {H}_{d}^{(m)}(x)\mathcal {H}_{d}(-x)=W_{d,m}(x) \end{aligned}$$

    we see that the coefficient near \(x^{n}\) in the power series expansion of the function \(\mathcal {H}_{d}^{(m)}(x)\mathcal {H}_{d}(-x)\) is just the coefficient of \(W_{d,m}(x)\) near \(x^{n}\). But in this case the n-th coefficient is exactly the sum stated in the statement of our result.

  4. (4)

    It is clear that the function \(\mathcal {H}_{d}(x)W_{d,n}(x)\) is the coefficient near \(t^{n}/n!\) in the power series expansion of the function \(\mathcal {H}_{d}(x)\mathcal {W}_{d}(x,t)\) in the neighborhood of the point \(t=x\). Indeed,

    $$\begin{aligned} \mathcal {H}_{d}(x)\mathcal {W}_{d}(x,t)&=\mathcal {H}_{d}(x)\sum _{n=0}^{\infty }\frac{W_{d,n}(x)}{n!}t^{n}=\sum _{n=0}^{\infty }\frac{\mathcal {H}_{d}^{(n)}(x)}{n!}t^{n}\\&=\sum _{n=0}^{\infty }\frac{\mathcal {H}_{d}^{(n)}(x)}{n!}((t+x)-x)^{n}=\mathcal {H}_{d}(t+x). \end{aligned}$$

    Multiplying both sides by \(\mathcal {H}_{d}(x)^{-1}\) we get

    $$\begin{aligned} \mathcal {W}_{d}(x,t)=e^{-x-\frac{x^{d}}{d}}\mathcal {H}_{d}(x+t)=e^{t+\frac{(t+x)^{d}-x^{d}}{d}} \end{aligned}$$

    and hence the result. \(\square \)

As an immediate consequence of the shape of exponential generating function for \((W_{d,n}(x))_{n\in \mathbb {N}}\) we get the following:

Corollary 6.2

The sequence \((W_{d,n}(x))_{n\in \mathbb {N}}\) satisfies the following recurrence relation: \(W_{d,n}(x)=0\) for \(n<0\), \(W_{d,0}(x)=1\) and

$$\begin{aligned} W_{d,n}(x)=(1+x^{d-1})W_{d,n-1}(x)+\sum _{j=2}^{d}\left( {\begin{array}{c}d-1\\ j-1\end{array}}\right) (n-1)_{(j-1)}x^{d-j}W_{d,n-j}(x) \end{aligned}$$

for \(n\ge 1\).

Proof

By comparing the coefficients near \(t^{n}\) in the identity

$$\begin{aligned} \frac{\partial \mathcal {W}_{d}(x,t)}{\partial t}=(1+(t+x)^{d-1})\mathcal {W}_{d}(x,t) \end{aligned}$$

we get the equality

$$\begin{aligned} \frac{1}{n!}W_{d,n+1}(x)=\frac{1}{n!}(1+x^{d-1})W_{d,n}(x)+\sum _{i=1}^{d-1}\frac{1}{(n-i)!}\left( {\begin{array}{c}d-1\\ i\end{array}}\right) W_{d,n-i}(x). \end{aligned}$$

Multiplying both sides by n!, writing \(n!/(n-i)!\) as \((n)_{(i-1)}\) and replacing n by \(n-1\) and i by \(j-1\) we get the result (with the convention \(W_{d,n}(x)=0\) for \(n<0\)). \(\square \)

Remark 6.3

In the proof of Corollary 6.2 we proved recurrence relation for the sequence \((W_{d,n}(x))_{n\in \mathbb {N}}\) by manipulating of exponential generating functions. One can also consider the (formal) ordinary generating function of the sequence \((W_{d,n}(x))_{n\in \mathbb {N}}\) and get a relation of a different kind. Indeed, it is an easy exercise to prove that the (formal) power series \(\mathcal {S}_{d}(x,t)=\sum _{n=0}^{\infty }W_{d,n}(x)t^n\) satisfies the differential equation

$$\begin{aligned} (1-(1+x^{d-1})t)\mathcal {S}_{d}(x,t)=1+t\frac{\partial \mathcal {S}_{d}(x,t)}{\partial x}. \end{aligned}$$

Multiplying both sides of the above identity by \((1-(1+x^{d-1})t)^{-1}\) and comparing coefficients near \(t^n\) we easily deduce the following relation

$$\begin{aligned} W_{d,n}(x)=(1+x^{d-1})^{n}+\sum _{k=1}^{n}(1+x^{d-1})^{n-k}W_{d,k-1}'(x). \end{aligned}$$

This gives us an expression of \(W_{d,n}(x)\) in terms of the sequence \((W_{d,n}'(x))_{n\in \mathbb {N}}\).

Remark 6.4

Let us note that the sequence \((W_{2,m}(x))_{m\in \mathbb {N}}\) was implicitly studied by Amdeberhan and Moll (Corollary 2.6 in [1]). Although the mentioned authors did not find recurrence relation for this sequence they were able to get the closed form

$$\begin{aligned} W_{2,n}(x)=\sum _{i=0}^{n}\left( {\begin{array}{c}n\\ i\end{array}}\right) H_{2}(n-i)x^{i}. \end{aligned}$$

From our result we get \(W_{2,0}(x)=1, W_{2,1}(x)=1+x\) and for \(n\ge 2\) we have

$$\begin{aligned} W_{2,n}(x)=(1+x)W_{2,n-1}(x)+(n-1)W_{2,n-2}(x). \end{aligned}$$

This allows us to deduce the following nice identity:

$$\begin{aligned} W_{2,n}(-1)=\sum _{i=0}^{n}(-1)^{i}\left( {\begin{array}{c}n\\ i\end{array}}\right) H_{2}(n-i)={\left\{ \begin{array}{ll} \begin{array}{ll} 0 &{}\quad \text{ if }\;n\equiv 1\pmod {2}\\ \frac{(2m)!}{2^{m}m!} &{}\quad \text{ if }\;n=2m \end{array} \end{array}\right. }. \end{aligned}$$

Indeed, taking \(x=-1\) in the recurrence relation for \(W_{2,n}(x)\) we get \(W_{2,n}(-1)=(n-1)W_{2,n-2}(-1)\). Because \(W_{2,0}(-1)=1\) and \(W_{2,1}(-1)=0\) by a simple iteration of the above recurrence we get the formula presented above.

Let us also note that the value of \(W_{2,n}(x)\) at \(x=1\) has striking combinatorial interpretation. Indeed, the sequence \((W_{2,n}(1))_{n\in \mathbb {N}}\) satisfies the recurrence relation: \(W_{2,0}(1)=1, W_{2,1}(1)=2\) and

$$\begin{aligned} W_{2,n}(1)=2W_{2,n-1}(1)+(n-1)W_{2,n-2}(1)\quad \text{ for }\quad n\ge 2. \end{aligned}$$

In particular, \((W_{2,n}(1))_{n\in \mathbb {N}}\) is a binomial transform of the sequence \((H_{2}(n))_{n\in \mathbb {N}}\). Moreover, as was observed by Donaghey [4], this sequence enumerates the general switchboard problem, i.e., it enumerates the states of a telephone exchange with n subscribers which is provided with means to connect subscribers singly to outside lines and in pairs internally (no conference circuits).

The last results of this section are devoted to the behaviour of sequences \((W_{d,m}(x)\pmod {c})_{m\in \mathbb {N}}\) where \(c=d-1\) or \(c=d=p\) is a prime number.

Theorem 6.5

The following congruence holds for each \(d\ge 2\) and \(m\in \mathbb {N}\):

$$\begin{aligned} W_{d,m}(x)\equiv (1+x^{d-1})^m\pmod {d-1}. \end{aligned}$$

In particular, if p is a prime number then

$$\begin{aligned} W_{p+1,m}(x)\equiv (1+x)^{pm}\pmod {p} \end{aligned}$$

for any \(m\in \mathbb {N}\).

Proof

We proceed by induction on \(m\in \mathbb {N}\). If \(m=0\) then \(W_{d,0}(x)=1\), hence the statement of our theorem is true. If \(m>0\) then we use Corollary 6.2 and the induction hypothesis for \(m-1\) and get

$$\begin{aligned} W_{d,m}(x)&=(1+x^{d-1})W_{d,m-1}(x)+\sum _{j=2}^{d}\left( {\begin{array}{c}d-1\\ j-1\end{array}}\right) (m-1)_{(j-1)}x^{d-j}W_{d,m-j}(x)\\&\equiv (1+x^{d-1})\cdot (1+x^{d-1})^{m-1}\\&\quad +\sum _{j=2}^{d}\left( {\begin{array}{c}m-1\\ j-1\end{array}}\right) (d-1)_{(j-1)}x^{d-j}W_{d,m-j}(x)\\&\equiv (1+x^{d-1})^m\pmod {d-1}. \end{aligned}$$

\(\square \)

Theorem 6.6

For each prime p we have \(W_{p,p}(x)\equiv x^{p(p-1)}\pmod {p}\).

Proof

We easily check that we have \(W_{2,2}(x)=x^2+2x+2\), so assertion holds for \(p=2\). Now we assume that p is an odd prime number. We will show that all the coefficients of the polynomial \(W_{p,p}(x)\) except for the leading one are divisible by p. We use the formula

$$\begin{aligned} A_p(n,p)&=\frac{1}{n!}\sum _{k=0}^{n}\left( {\begin{array}{c}n\\ k\end{array}}\right) (-1)^{n-k}H_{p}(p+k)H_{p}(n-k)\\&=\sum _{k=0}^{n}(-1)^{n-k}\frac{H_{p}(p+k)}{k!}\cdot \frac{H_{p}(n-k)}{(n-k)!},\quad 0\le n\le p(p-1) \end{aligned}$$

from the third part of the statement of Theorem 6.1. It suffices to prove that for each \(n\in \{0,\ldots ,p(p-1)-1\}\) and \(k\in \{0,\ldots ,n\}\) we have \(\nu _p\left( \frac{H_{p}(p+k)}{k!}\cdot \frac{H_{p}(n-k)}{(n-k)!}\right) \ge 1\). By Corollary 4.5, \(\nu _p(H_p(p+k))\ge 1+\left\lfloor \frac{k}{p}\right\rfloor \) and \(\nu _p(H_p(n-k))\ge \left\lfloor \frac{n-k}{p}\right\rfloor \). On the other hand, it is easy to see that \(\nu _p(k!)=\left\lfloor \frac{k}{p}\right\rfloor \) and \(\nu _p((n-k)!)=\left\lfloor \frac{n-k}{p}\right\rfloor \). Summing up the above observations, we get \(\nu _p\left( \frac{H_{p}(p+k)}{k!}\cdot \frac{H_{p}(n-k)}{(n-k)!}\right) \ge 1\) and the statement of our corollary follows for any odd prime p. \(\square \)

Theorem 6.7

The sequence

$$\begin{aligned} (W_{p,m}(x)x^{p(1-p)\lfloor \frac{m}{p}\rfloor }\pmod {p})_{m\in \mathbb {N}} \end{aligned}$$

is periodic and the length of the period is p.

In particular

$$\begin{aligned}&(W_{2,m}(x)x^{-2\lfloor \frac{m}{2}\rfloor }\pmod {2})_{m\in \mathbb {N}}=\overline{(1,1+x)},\\&(W_{3,m}(x)x^{-6\lfloor \frac{m}{3}\rfloor }\pmod {3})_{m\in \mathbb {N}}=\overline{(1,1+x^2,(x+2)(x^3+x^2+2))}. \end{aligned}$$

Proof

First, we prove by induction on \(m\in \mathbb {N}\) that

$$\begin{aligned} W_{p,m+p}(x)\equiv x^{p(p-1)}W_{p,m}(x)\pmod {p},\quad m\in \mathbb {N}. \end{aligned}$$
(13)

The above congruence is satisfied for \(m=0\) by the Theorem 6.6. Assume now that (13) holds for some \(m\in \mathbb {N}\) and we will show that it holds for \(m+1\). By (12) we get

$$\begin{aligned} W_{p,m+1+p}(x)&= (1+x^{p-1})W_{p,m+p}(x)+W'_{p,m+p}(x)\\&\equiv (1+x^{p-1})x^{p(p-1)}W_{p,m}(x)+(x^{p(p-1)}W_{p,m}(x))'\\&= (1+x^{p-1})x^{p(p-1)}W_{p,m}(x)+p(p-1)x^{p(p-1)-1}W_{p,m}(x)\\&\quad +x^{p(p-1)}W'_{p,m}(x)\\&\equiv x^{p(p-1)}[(1+x^{p-1})W_{p,m}(x)+W'_{p,m}(x)]\\&= x^{p(p-1)}W_{p,m+1}(x)\pmod {p}. \end{aligned}$$

Now we have congruence (13) proved. Let us fix \(m\in \mathbb {N}\) and write \(m=jp+i\). Then, using (13) j times, we get

$$\begin{aligned} W_{p,m}(x)\equiv x^{p(p-1)j}W_{p,i}(x)\pmod {p}. \end{aligned}$$

After multiplication by \(x^{p(1-p)j}\) and substitution \(j=\left\lfloor \frac{m}{p}\right\rfloor \) and \(i=m\pmod p\) we obtain

$$\begin{aligned} W_{p,m}(x)x^{p(1-p)\left\lfloor \frac{m}{p}\right\rfloor }\equiv W_{p,m\pmod p}(x)\pmod {p} \end{aligned}$$

and get the result. \(\square \)

7 Divisors of numbers \(H_d(n)\)

In this section we study various properties of the numbers \(H_d(n)\) and \(H_d(n)-1\). We are interested in prime divisors and various \(\text {GCD}\) properties.

7.1 Prime divisors of numbers \(H_d(n)\)

Let us denote \({\mathbb {P}}_d=\{p\in {\mathbb {P}}: p\mid H_{d}(n) \text{ for } \text{ some } n\in \mathbb {N}\}\).

Theorem 7.1

For each \(d\in \mathbb {N}_{\ge 2}\) the set \({\mathbb {P}}_d\) is infinite.

Proof

Assume by the contrary that \(p_1<\cdots <p_s\) are all the elements of the set \(\mathbb {P}_d\). We consider two cases. The first case is when d is a composite number. We put \(P=p_1\cdots p_s\). By Corollary 3.8 we know that the sequence \((H_d(n)\pmod {P})_{n\in \mathbb {N}}\) is periodic of period P, as \(2<d\) and thus 2 is not a divisor of any number \(H_d(n)\). In particular, the numbers \(H_d(Pm)\), \(m\in \mathbb {N}\), are congruent to 1 modulo P. Hence these numbers have no prime divisors. This combined with the fact that \(H_d(Pm)>0\) implies \(H_d(Pm)=1\) for any \(m\in \mathbb {N}\). However, this is a contradiction with the fact that the sequence \((H_d(n))_{n\in \mathbb {N}}\) is an ultimately strictly increasing sequence of positive integers.

The second case is when d is a prime number. Then \(p_1=d=H_d(d)\). We put \(P=p_1^2\cdot p_2\cdots p_s\) and \(Q=p_2\cdots p_s\). By Corollary 3.8 we know that the sequence \((H_d(n)\pmod {Q})_{n\in \mathbb {N}}\) is periodic of the period Q, as d is a prime number not dividing Q. In particular, since \(Q\mid P\), we have \(H_d(Pm)\equiv H_d(Pm+1)\equiv 1\pmod {p_i}\) for \(m\in \mathbb {N}\) and \(i\in \{2,\ldots ,s\}\). According to Corollary 4.5, \(\nu _{p_1}(H_d(Pm))=\nu _{p_1}(H_d(Pm+1))=Qm(p_1-1)\). Since \(H_d(Pm)>0\) and \(p_1,\ldots ,p_s\) are all possible divisors of the numbers \(H_d(n)\), \(n\in \mathbb {N}\), thus \(H_d(Pm)=H_d(Pm+1)=p_1^{Qm(p_1-1)}\) for any \(m\in \mathbb {N}\). However, \(H_d(Pm+1)=H_d(Pm)+(Pm)_{(d-1)}H_d(Pm-d+1)>H_d(Pm)\) for \(m\ge \frac{d-1}{P}\) – a contradiction. \(\square \)

Conjecture 7.2

For each \(d\in \mathbb {N}_{\ge 2}\) the set \({\mathbb {P}}\backslash {\mathbb {P}}_d\) is infinite and its asymptotic density in \({\mathbb {P}}\) is equal to \(\frac{1}{e}\).

The following heuristic reasoning allows us to claim the second statement in the conjecture above. If we fix a prime number p and randomly choose a sequence \((a_n)_{n\in \mathbb {N}}\) such that the sequence \((a_n\pmod {p})_{n\in \mathbb {N}}\) has the period p, then the probability that p does not divide any term of this sequence is equal to \(\left( 1-\frac{1}{p}\right) ^p\). The probability tends to \(\frac{1}{e}\) with \(p\rightarrow +\infty \). Note that \(p>d\) belongs to the set \({\mathbb {P}}\backslash {\mathbb {P}}_d\) if and only if p does not divide any number \(H_d(n)\) for \(n\in \{d,\ldots ,p-1\}\). Moreover, the sequence \((H_d(n)\pmod p)_{n\in \mathbb {N}}\) is periodic of the period p. Therefore we suppose that the probability that \(p\in {\mathbb {P}}\backslash {\mathbb {P}}_d\) equals to \(\left( 1-\frac{1}{p}\right) ^{p-d}\). Thus, this probability tends to \(\frac{1}{e}\) with \(p\rightarrow +\infty \) and hence the asymptotic density of the set \({\mathbb {P}}\backslash {\mathbb {P}}_d\) in the set \({\mathbb {P}}\) is expected to be equal to \(\frac{1}{e}\).

Remark 7.3

We performed small numerical search in order to check whether our expectations are likely to be true. More precisely, for \(d\in \{2,\ldots , 10\}, k\le 4000\) and \(n\in \{d,\ldots , p_{k}\}\) we computed the number of primes \(p_i\) such that \(p_{i}|H_{d}(n)\). In the table below we present the result of our computations.

The numbers in the last row in the table above are quite close to the number \(1 - 1/e\simeq 0.63212\), which is the conjectured density of the set \({\mathbb {P}}_{d}\) in the set \({\mathbb {P}}\) (Table 1).

Table 1 The number of integers \(k\le 4000\) such that \(H_{d}(n)\equiv 0\pmod {p_{k}}\) for some positive integer \(n\le p_{k}\) and \(d\in \{2,\ldots , 10\}\)

7.2 Greatest common divisors of numbers \(H_d(n)-1\) and n

Performing numerical computations, we observed a quite interesting formula for the greatest common divisor of the number \(H_d(n)\) and its index n.

Theorem 7.4

Let \(d,n\in \mathbb {N}\) with \(d\ge 2\). Then the number \(\text {GCD}(H_d(n)-1,n)\) is equal to

  • n if d is a composite number not equal to 4 or \(d=4\) and \(\nu _2(n)\ne 2\);

  • \(\frac{n}{2}\) if \(d=4\) and \(\nu _2(n)=2\);

  • \(\frac{n}{d^{\nu _d(n)}}\) if d is a prime number.

Proof

At first, let us prove the theorem for d composite. Let us note the equality:

$$\begin{aligned} \begin{aligned} H_d(n)-1&=\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }\frac{(n)_{(dk)}}{k!d^k}=n\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }\frac{(n-1)_{(dk-1)}}{k!d^k}=n\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }\frac{(n-1)_{(dk-1)}}{(dk-1)!}\cdot \frac{(dk-1)!}{k!d^k}\\&=n\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }{n-1\atopwithdelims ()dk-1}\cdot \frac{(dk-1)_{((d-1)k-1)}}{d^k}. \end{aligned} \end{aligned}$$
(14)

For \(d\ne 4\) it suffices to show that \(\frac{(dk-1)_{((d-1)k-1)}}{d^k}\) is an integer for each \(k\in \left\{ 1,\ldots ,\left\lfloor \frac{n}{d}\right\rfloor \right\} \). If \(k=1\), then

$$\begin{aligned} \frac{(dk-1)_{((d-1)k-1)}}{d^k}=\frac{(d-1)_{(d-2)}}{d}=\frac{(d-1)!}{d}\in \mathbb {Z}, \end{aligned}$$

as d is a composite number greater than 4. If \(k=2\) then

$$\begin{aligned} \frac{(dk-1)_{((d-1)k-1)}}{d^k}&=\frac{(2d-1)_{(2d-3)}}{d^2}=\frac{(2d-1)!}{2d^2}\\&=\frac{(d-1)!}{d}\cdot \frac{d}{d}\cdot \frac{(d+1)\cdots (2d-1)}{2}, \end{aligned}$$

where \(\frac{(d-1)!}{d}\) is an integer and 2 divides some of the \(d-1\) factors \(d+1,\ldots ,2d-1\) as \(d\ge 6\). Assume that \(k\ge 3\). In order to prove that \(\frac{(dk-1)_{((d-1)k-1)}}{d^k}\) is an integer, we will show that \(\nu _p\left( \frac{(dk-1)_{((d-1)k-1)}}{d^k}\right) \ge 0\) for each prime number p. Let us write:

$$\begin{aligned} \nu _p\left( \frac{(dk-1)_{((d-1)k-1)}}{d^k}\right) =\nu _p((dk-1)\cdots (k+1))-k\nu _p(d). \end{aligned}$$

We see that if \(\nu _p(d)=0\) then \(\nu _p\left( \frac{(dk-1)_{((d-1)k-1)}}{d^k}\right) \ge 0\). Thus, assume now that \(p\mid d\). Then, we estimate \(\nu _p((dk-1)\cdots (k+1))\) from below by the number of multiplicities of p among the integers from \(k+1\) to \(dk-1\). This number is at least equal to \(\left\lfloor \frac{(d-1)k-1}{p}\right\rfloor \). Hence,

$$\begin{aligned} \nu _p((dk-1)\cdots (k+1))-k\nu _p(d)\ge & {} \left\lfloor \frac{(d-1)k-1}{p}\right\rfloor -k\nu _p(d)\nonumber \\= & {} \left\lfloor \frac{dk-k-1}{p}\right\rfloor -k\nu _p(d)\nonumber \\= & {} \frac{d}{p}k-\left\lceil \frac{k+1}{p}\right\rceil -k\nu _p(d)\nonumber \\= & {} k\left( \frac{d}{p}-\nu _p(d)\right) -\left\lceil \frac{k+1}{p}\right\rceil \nonumber \\\ge & {} k\left( \frac{d}{p}-\nu _p(d)\right) -\frac{k+1}{p}-1. \end{aligned}$$
(15)

If \(\nu _p(d)\ge 3\) or \(p>2\) and \(\nu _p(d)\ge 2\) then \(d\ge p^{\nu _p(d)}\). Thus the last expression in (15) is bounded from below by \(k(p^{\nu _p(d)-1}-\nu _p(d))-\frac{k+p+1}{p}\). We have the following chain of equivalences:

$$\begin{aligned}&k(p^{\nu _p(d)-1}-\nu _p(d))-\frac{k+p+1}{p}\ge 0\\&\quad \Leftrightarrow k(p^{\nu _p(d)-1}-\nu _p(d))\ge \frac{k+p+1}{p}\\&\quad \Leftrightarrow p^{\nu _p(d)-1}-\nu _p(d)\ge \frac{k+p+1}{kp}. \end{aligned}$$

The left hand side of the last inequality is at least equal to 1. Since \(k\ge 3\) and \(p\in \mathbb {P}\) then \(\frac{1}{p}+\frac{1}{k}+\frac{1}{kp}\le 1\). In consequence \(\nu _p\left( \frac{(dk-1)_{((d-1)k-1)}}{d^k}\right) \ge 0\) for any prime p such that \(\nu _p(d)\ge 3\) or \(p>2\) and \(\nu _p(d)\ge 2\).

If \(\nu _p(d)=1\) or \(p=2\) and \(\nu _2(d)=2\) then \(d\ge 2p^{\nu _p(d)}\). Thus the last expression in (15) is bounded from below by \(k(2p^{\nu _p(d)-1}-\nu _p(d))-\frac{k+p+1}{p}\). We have the following chain of equivalences:

$$\begin{aligned}&k(2p^{\nu _p(d)-1}-\nu _p(d))-\frac{k+p+1}{p}\ge 0\\&\quad \Leftrightarrow k(2p^{\nu _p(d)-1}-\nu _p(d))\ge \frac{k+p+1}{p}\\&\quad \Leftrightarrow 2p^{\nu _p(d)-1}-\nu _p(d)\ge \frac{k+p+1}{kp}. \end{aligned}$$

The left hand side of the last inequality is at least equal to 1 and the right hand side, as we have seen earlier, is at most equal to 1. Validity of the last inequality implies that \(\nu _p\left( \frac{(dk-1)_{((d-1)k-1)}}{d^k}\right) \ge 0\) for any prime p such that \(\nu _p(d)=1\) or \(p=2\) and \(\nu _2(d)=2\).

We have just proven that \(\frac{(dk-1)_{((d-1)k-1)}}{d^k}\) is an integer for each \(k\in \left\{ 1,\ldots ,\left\lfloor \frac{n}{d}\right\rfloor \right\} \). Thus \(\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }{n-1\atopwithdelims ()dk-1}\cdot \frac{(dk-1)_{((d-1)k-1)}}{d^k}\in \mathbb {Z}\) and, as a result, \(n\mid H_d(n)-1\) in the case of \(d>4\) composite.

Let us consider now the case of \(d=4\). By (14) we know that \(H_4(n)-1=n\sum _{k=1}^{\left\lfloor \frac{n}{4}\right\rfloor }{n-1\atopwithdelims ()4k-1}\cdot \frac{(4k-1)!}{k!4^k}\). If p is an odd prime number, then \(\nu _p\left( \frac{(4k-1)!}{k!4^k}\right) =\nu _p((4k-1)_{(3k-1)})\ge 0\). We have

$$\begin{aligned} \nu _2\left( \frac{(4k-1)!}{k!4^k}\right)&=4k-1-s_2(4k-1)-k+s_2(k)-2k\\&=k-1-s_2(4(k-1)+3)+s_2(k)=k-1-s_2(k-1)-2+s_2(k)\\&=k-2-s_2(k-1)-s_2(1)+s_2(k)=k-2-\nu _2\left( k\atopwithdelims ()1\right) \\&=k-2-\nu _2(k). \end{aligned}$$

In the above computation we used the Legendre formula \(\nu _2(m!)=m-s_2(m)\) and its corollary \(\nu _2\left( m\atopwithdelims ()l\right) =s_2(l)+s_2(m-l)-s_2(m)\) for \(0\le l\le m\). The value \(k-2-\nu _2(k)\) is non-negative for \(k\ge 3\) and equal to \(-1\) for \(k\in \{1,2\}\). Hence, the value of \({n-1\atopwithdelims ()4k-1}\cdot \frac{(4k-1)!}{k!4^k}\) is an integer for \(k\ge 3\). Meanwhile for \(k\in \{1,2\}\) we compute \(\nu _2\left( n-1\atopwithdelims ()4k-1\right) \). For \(k=1\) we have

$$\begin{aligned} \nu _2\left( n-1\atopwithdelims ()4k-1\right)&=\nu _2\left( n-1\atopwithdelims ()3\right) =\nu _2\left( \frac{(n-1)(n-2)(n-3)}{6}\right) \\&=\nu _2((n-1)(n-2)(n-3))-1 \end{aligned}$$

which is equal to 0 if and only if \(4\mid n\). For \(k=2\) we have

$$\begin{aligned} \nu _2\left( n-1\atopwithdelims ()4k-1\right) =\nu _2\left( n-1\atopwithdelims ()7\right) =\nu _2\left( \frac{(n-1)\cdots (n-7)}{7!}\right) \end{aligned}$$

which is equal to 0 if and only if \(8\mid n\). If \(\nu _2(n)<2\) then \(\nu _2\left( n-1\atopwithdelims ()4k-1\right) \ge 1\) for \(k\in \{1,2\}\) and, as a consequence, \(\nu _2\left( {n-1\atopwithdelims ()4k-1}\cdot \frac{(4k-1)!}{k!4^k}\right) \ge 0\) for any \(k\le \left\lfloor \frac{n}{4}\right\rfloor \). If \(\nu _2(n)=2\) then \(\nu _2\left( {n-1\atopwithdelims ()4k-1}\cdot \frac{(4k-1)!}{k!4^k}\right) \ge 0\) for \(k>1\) and \(\nu _2\left( {n-1\atopwithdelims ()4k-1}\cdot \frac{(4k-1)!}{k!4^k}\right) =-1\) for \(k=1\). Thus \(\nu _2\left( \sum _{k=1}^{\left\lfloor \frac{n}{4}\right\rfloor }{n-1\atopwithdelims ()4k-1}\cdot \frac{(4k-1)!}{k!4^k}\right) =-1\). If \(\nu _2(n)>2\) then \(\nu _2\left( {n-1\atopwithdelims ()4k-1}\cdot \frac{(4k-1)!}{k!4^k}\right) \ge 0\) for \(k>2\) and \(\nu _2\left( {n-1\atopwithdelims ()4k-1}\cdot \frac{(4k-1)!}{k!4^k}\right) =-1\) for \(k\le 2\). Thus \(\nu _2\left( \sum _{k=1}^{\left\lfloor \frac{n}{4}\right\rfloor }{n-1\atopwithdelims ()4k-1}\cdot \frac{(4k-1)!}{k!4^k}\right) \ge 0\). Summing up, if \(\nu _2(n)\ne 2\) then \(\left( \sum _{k=1}^{\left\lfloor \frac{n}{4}\right\rfloor }{n-1\atopwithdelims ()4k-1}\cdot \frac{(4k-1)!}{k!4^k}\right) \) is an integer and then \(n\mid H_4(n)-1\). If \(\nu _2(n)=2\) then \(2\left( \sum _{k=1}^{\left\lfloor \frac{n}{4}\right\rfloor }{n-1\atopwithdelims ()4k-1}\cdot \frac{(4k-1)!}{k!4^k}\right) \) is an integer and then \(\frac{n}{2}\mid H_4(n)-1\) while \(n\not \mid H_4(n)-1\). The proof for the case of \(d=4\) is finished.

Let us consider the case of prime d. If \(n<d\) then \(H_d(n)-1=0\) and obviously \(n\mid H_d(n)-1\). If \(n\ge d\) then \(d\mid H_d(n)\) and thus \(d\not \mid H_d(n)-1\). Let us write

$$\begin{aligned} H_d(n)-1&=\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }\frac{(n)_{(dk)}}{k!d^k}=\frac{n}{d^{\nu _d(n)}}\cdot d^{\nu _d(n)}\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }\frac{(n-1)_{(dk-1)}}{k!d^k}\\&=\frac{n}{d^{\nu _d(n)}}\cdot d^{\nu _d(n)}\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }\frac{(n-1)_{(dk-1)}}{(dk-1)!}\cdot \frac{(dk-1)!}{k!d^k}\\&=\frac{n}{d^{\nu _d(n)}}\cdot d^{\nu _d(n)}\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }{n-1\atopwithdelims ()dk-1}\cdot \frac{(dk-1)_{((d-1)k-1)}}{d^k}. \end{aligned}$$

Since \(d\not \mid \frac{n}{d^{\nu _d(n)}}\), we thus have \(\nu _d\left( d^{\nu _d(n)}\sum _{k{=}1}^{\left\lfloor \frac{n}{d}\right\rfloor }{n-1\atopwithdelims ()dk-1}\cdot \frac{(dk-1)_{((d-1)k-1)}}{d^k}\right) {=}\nu _d(H_d(n)-1)=0.\) If p is a prime number not equal to d then

$$\begin{aligned} \nu _p\left( \frac{(dk-1)_{((d-1)k-1)}}{d^k}\right) =\nu _p((dk-1)_{((d-1)k-1)})\ge 0 \end{aligned}$$

and \(\nu _p\left( d^{\nu _d(n)}\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }{n-1\atopwithdelims ()dk-1}\cdot \frac{(dk-1)_{((d-1)k-1)}}{d^k}\right) \ge 0\). Finally,

$$\begin{aligned} d^{\nu _d(n)}\sum _{k=1}^{\left\lfloor \frac{n}{d}\right\rfloor }{n-1\atopwithdelims ()dk-1}\cdot \frac{(dk-1)_{((d-1)k-1)}}{d^k}\in \mathbb {Z}, \end{aligned}$$

which means that \(\frac{n}{d^{\nu _d(n)}}\mid H_d(n)-1\) and \(\frac{n}{d^{\nu _d(n)}}=\text {GCD}(H_d(n)-1,n)\). \(\square \)

7.3 Nontrivial common divisors of numbers \(H_a(n)\) and \(H_b(n)\)

Let us fix two distinct integers \(a,b\ge 2\). It is natural to ask about existence of indices n for which the numbers \(H_a(n)\) and \(H_b(n)\) have a common divisor greater than 1. The above question can be answered immediately. Let \(d\in \mathbb {N}_{\ge 2}\), \(n\in \mathbb {N}_{\ge d}\) and p be a prime divisor of \(H_d(n)\). Then \(p\mid \text {GCD}(H_d(n+p),H_p(n+p))\). Indeed, it is a simple consequence of periodicity of the sequence \((H_d(n)\pmod {p})_{n\in \mathbb {N}}\) and divisibility properties of the sequence \((H_p(n))_{n\in \mathbb {N}}\) for prime number p. Moreover, we give the following.

Theorem 7.5

Let \(d\in \mathbb {N}_{\ge 3}\). Then \(2d+1\mid H_d(3d+2)\) if and only if \(2d+1\mid d!-1\).

If additionally d is odd then

  • \(2d+1\mid H_{2d+1}(3d+2)\) if and only if \(2d+1\mid (d!)^2-1\).

  • \(2d+1\mid H_d(4d)\) if and only if \(2d+1\mid d!+1\);

  • \(2d+1\mid H_{2d+1}(4d)\) if and only if \(2d+1\mid (d!)^2-1\).

Proof

Since the proofs of the remaining equivalences are very similar, we only show the second equivalence.

By the exact formula for \(H_{2d+1}(3d+2)\) we have \(H_{2d+1}(3d+2)=1+\frac{(3d+2)_{(2d+1)}}{2d+1}\). We compute

$$\begin{aligned}&1+(3d+2)\cdots (2d+2)(2d)\cdots (d+2)\equiv 1+(-d)d\cdots 1\cdot (-1)\cdots (1-d)\\&\quad \equiv 1+ (-1)^{d}(d!)^2\equiv 1-(d!)^2\pmod {2d+1} \end{aligned}$$

and we see that the divisibility of \(H_{2d+1}(3d+2)\) by \(2d+1\) is equivalent to the divisibility of \((d!)^2-1\) by \(2d+1\). \(\square \)

In the above theorem we needed assumption that d is odd. The next proposition shows that primality of \(2d+1\) is necessary and sufiicient for validity of the condition \(2d+1\mid (d!)^2-1\).

Proposition 7.6

Let d be an odd positive integer. Then \(2d+1\mid (d!)^2-1\) if and only if \(2d+1\) is a prime number.

Proof

If \(2d+1\) is prime then \(2d+1\mid H_{2d+1}(3d+2)\) as \(3d+2\ge 2d+1\). Thus, by Theorem 7.5 there holds \(2d+1\mid (d!)^2-1\).

If \(2d+1\) is a composite number then by Corollary 3.8 we have \(H_{2d+1}(3d+2)\equiv H_{2d+1}(d+1)=1\pmod {2d+1}\) as \(d+1<2d+1\). Hence by Theorem 7.5 the condition \(2d+1\mid (d!)^2-1\) is not satisfied. \(\square \)

Now we are ready to give a formula for the one-parameter infinite family of quadruples (abnc) such that \(c>1\) divides both \(H_a(n)\) and \(H_b(n)\).

Corollary 7.7

If \(n\ge 3\) is an odd integer such that \(2n+1\) is a prime number then \(2n+1\) is a common divisor of numbers \(H_n(3n+2)\) and \(H_{2n+1}(3n+2)\) or \(H_n(4n)\) and \(H_{2n+1}(4n)\). More precisely,

  • \(2n+1\mid \text {GCD}(H_n(3n+2), H_{2n+1}(3n+2))\) if and only if \(2n+1\mid n!-1\);

  • \(2n+1\mid \text {GCD}(H_n(4n), H_{2n+1}(4n))\) if and only if \(2n+1\mid n!+1\).

In other words, if \((a,b,n,c)=(d,2d+1, [2d+1\mid d!-1]\cdot (3d+2)+[2d+1\mid d!+1]\cdot (4d), 2d+1)\), where d is an odd positive integer such that \(2d+1\) is a prime number and we use the Iverson bracket

$$\begin{aligned} {[}\varphi ]={\left\{ \begin{array}{ll}1, &{}\quad \text{ if } \varphi \text{ is } \text{ true }\\ 0, &{}\quad \text{ if } \varphi \text{ is } \text{ false }\end{array}\right. }, \end{aligned}$$

then \(c\mid \text {GCD}(H_a(n),H_b(n))\).

Let us observe that all the examples of quadruples (abnc) with the property that \(c>1\) divides both \(H_a(n)\) and \(H_b(n)\) are such that \(c=b\) is a prime number and \(n\ge b\). This is a motivation to formulate the following.

Question 7.8

Are there infinitely many triples \((a,b,c)\in \mathbb {N}^3\), \(a,b,c\ge 2\), such that \(c>1\) is coprime to ab and \(c\mid \text {GCD}(H_a(n),H_b(n))\) for some \(n\in \mathbb {N}\)?

Moreover, it is quite natural to ask the following.

Question 7.9

Are there infinitely many pairs \((a,b)\in \mathbb {N}^2\), \(a,b\ge 2\), such that \(\text {GCD}(H_a(n),H_b(n))=1\) for each \(n\in \mathbb {N}\)?

8 Some polynomials related to numbers \(H_d(n)\) and their combinatorial interpretation

Let us define polynomials \(H_{d}(n,x)\in \mathbb {Z}[x]\) recursively: \(H_{d}(n,x)=x^n\) for \(n\in \{0,\ldots ,d-1\}\) and

$$\begin{aligned} H_{d}(n,x)=xH_{d}(n-1,x)+(n-1)\cdots (n-d+1)H_{d}(n-d,x) \text{ for } n\ge d. \end{aligned}$$

Then \(H_{d}(n,1)=H_{d}(n)\) and we have exact formula

$$\begin{aligned} H_{d}(n,x)=\sum _{j=0}^{\left\lfloor \frac{n}{d}\right\rfloor } \frac{n!}{(n-dj)!j!d^j}x^{n-dj}. \end{aligned}$$

Proposition 8.1

The exponential generating function of the sequence \((H_{d}(n,x))_{n\in \mathbb {N}}\) takes the form

$$\begin{aligned} \mathcal {H}_d(x,t)=\sum _{n=0}^{+\infty }\frac{H_d(n,x)}{n!}t^n=e^{xt+\frac{t^d}{d}}. \end{aligned}$$

Proof

Let us write \(e^{xt+\frac{t^d}{d}}=\sum _{n=0}^{+\infty }\frac{a_d(n,x)}{n!}t^n\) By comparing the coefficients near \(t^{n-1}\) in the identity

$$\begin{aligned} \frac{\partial e^{xt+\frac{t^d}{d}}}{\partial t}=(x+t^{d-1})e^{xt+\frac{t^d}{d}} \end{aligned}$$

and multiplying by \((n-1)!\) we get the recurrence

$$\begin{aligned} a_{d}(n,x)=xa_{d}(n-1,x)+(n-1)\cdots (n-d+1)a_{d}(n-d,x) \text{ for } n\ge d. \end{aligned}$$

The above recurrence combined with the fact that

$$\begin{aligned} a_d(n,x)=\left. \frac{\partial ^n e^{xt+\frac{t^d}{d}}}{\partial t^n}\right| _{t=0}=x^n \end{aligned}$$

for \(n\in \{0,\ldots ,d-1\}\) implies \(a_d(n,x)=H_d(n,x)\) for each \(n\in \mathbb {N}\). \(\square \)

Theorem 8.2

Let \(\text {Fix}_{n}(\sigma )\) and \(S_{d,n}\) denote the set of fixed points of the permutation \(\sigma \in S_n\) and the set of permutations being product of pairwise disjoint d-cycles, respectively. Then, we have the following equality

$$\begin{aligned} H_{d}(n,x)=\sum _{\sigma \in S_{d,n}} x^{\#\text {Fix}_n(\sigma )}. \end{aligned}$$

Proof

Let us write the right hand side of the above equality as \(g_{d,n}(x)\). We will show that the sequence \((g_{d,n}(x))_{n\in \mathbb {N}}\) satisfies the same recurrence as the sequence \((H_d(n,x))_{n\in \mathbb {N}}\). This fact combined with obvious equality \(g_{d,n}(x)=x^n\) for \(n\in \{0,\ldots ,d-1\}\) will give us the statement of our theorem.

Let us fix \(\sigma \in S_{d,n}\). If \(\sigma (n)=n\) then \(\sigma =\sigma _1\) for some \(\sigma _1\in S_{d,n-1}\). The number of fixed points of \(\sigma \) is equal to the number of fixed points of \(\sigma _1\) increased by 1, since n is an extra fixed point of \(\sigma \). Hence the summand \(x^{\#\text {Fix}_n(\sigma )}\) in \(g_{d,n}(x)\) reduces with the summand \(x^{\#\text {Fix}_n(\sigma _1)+1}\) in \(xg_{d,n-1}(x)\). If \(\sigma (n)\ne n\) then \(\sigma =\sigma _1\circ \pi \), where \(\pi \) is a d-cycle containing n and \(\sigma _1\) is a product of pairwise disjoint d-cycles on a set \(\{1,\ldots ,n\}\backslash \text{ supp }(\pi )\). Then \(\sigma _1\) can be treated as a member of the set \(S_{d,n-d}\) and \(\#\text {Fix}_{n-d}(\sigma _1)=\#\text {Fix}_n(\sigma )\). Moreover, \(\pi \) can be chosen in \((n-1)_{(d-1)}\) ways. Thus the summand \(x^{\#\text {Fix}_n(\sigma )}\) in \(g_{d,n}(x)\) reduces with the summand \(x^{\#\text {Fix}_n(\sigma _1)}\) in \((n-1)_{(d-1)}g_{d,n-d}(x)\). Summing over all \(\sigma \in S_{d,n}\) we obtain \(g_{d,n}(x)=xg_{d,n-1}(x)+(n-1)_{(d-1)}g_{d,n-d}(x)\), which completes the proof. \(\square \)

For given \(d\in \mathbb {N}_{\ge 2}\), the sequence of polynomials \((H_{d}(n,x))_{n\in \mathbb {N}}\) contains more precise information concerning the number of permutations in \(S_{n}\) which are product of disjoint d-cycles. However, because our primary object of study is the sequence \((H_{d}(n))_{n\in \mathbb {N}}\), we offer only few results concerning this natural polynomial generalization. First we prove the following:

Theorem 8.3

Let \(d\in \mathbb {N}_{\ge 2}\). Then the following congruence holds for any \(n\in \mathbb {N}\):

  • \(H_d(n,x)\equiv x^n\pmod {d}\) if d is a composite number greater than 4;

  • \(H_d(n,x)\equiv x^n+2\left\lfloor \frac{n}{4}\right\rfloor x^{n-4}=x^{n-4\cdot \left( \left\lfloor \frac{n}{4}\right\rfloor \pmod {2}\right) }(x^4+2)^{\left\lfloor \frac{n}{4}\right\rfloor \pmod {2}}\pmod {d}\) if \(d=4\);

  • \(H_d(n,x)\equiv x^{n\pmod {d}}(x-1)^{d\left\lfloor \frac{n}{d}\right\rfloor }\pmod {d}\) if d is a prime number.

Proof

We will proceed by induction on \(n\in \mathbb {N}\). The statement of the theorem is true for \(n\in \{0,\ldots ,d-1\}\). Let us suppose that \(d>4\) is a composite number and \(n\ge d\). Then the product of consecutive \(d-1\) integers is divisible by d, thus by the recurrence formula and inductive hypothesis for \(n-1\) we have

$$\begin{aligned} H_d(n,x){=}xH_d(n-1,x){+}(n-1)_{(d-1)}H_d(n-d,x)\equiv x\cdot x^{n-1}{=}x^n\pmod {d}. \end{aligned}$$

Suppose now that \(d=4\) and \(n\ge 4\). If \(4\mid n\) then, by the recurrence defining polynomials \(H_4(n,x)\), inductive hypothesis for \(n-1\) and \(n-4\) and the fact that \((n-1)_{(3)}\equiv 3!\equiv 2\pmod {4}\), we obtain the following:

$$\begin{aligned} H_4(n,x)&= xH_4(n-1,x)+(n-1)_{(3)}H_4(n-4,x)\\&\equiv x^n+2\left\lfloor \frac{n-1}{4}\right\rfloor x^{n-4}+2\cdot \left( x^{n-4}+2\left\lfloor \frac{n-4}{4}\right\rfloor x^{n-8}\right) \\&\equiv x^n+2\left\lfloor \frac{n-1}{4}\right\rfloor x^{n-4}+2\cdot x^{n-4}\\&=x^n+2\left( \left\lfloor \frac{n-1}{4}\right\rfloor +1\right) x^{n-4}=x^n+2\left\lfloor \frac{n}{4}\right\rfloor x^{n-4}\pmod {4}. \end{aligned}$$

If \(4\not \mid n\) then, by the recurrence defining polynomials \(H_4(n,x)\), inductive hypothesis for \(n-1\) and the fact that among the numbers \(n-3\), \(n-2\), \(n-1\) there is a one divisible by 4, we obtain the following:

$$\begin{aligned} H_4(n,x)&= xH_4(n-1,x)+(n-1)_{(3)}H_4(n-4,x)\equiv x^n+2\left\lfloor \frac{n-1}{4}\right\rfloor x^{n-4}\\&=x^n+2\left\lfloor \frac{n}{4}\right\rfloor x^{n-4}\pmod {4}. \end{aligned}$$

Since the polynomial \(x^4+2\) is irreducible over the ring \(\mathbb {Z}/4\mathbb {Z}\), thus \(H_4(n,x)\equiv x^n+2\left\lfloor \frac{n}{4}\right\rfloor x^{n-4}=x^{n-4\cdot \left( \left\lfloor \frac{n}{4}\right\rfloor \pmod {2}\right) }(x^4+2)^{\left\lfloor \frac{n}{4}\right\rfloor \pmod {2}}\pmod {4}\) is a factorization of the polynomial \(H_4(n,x)\) modulo 4.

Assume now that d is a prime number and \(n\ge d\) and the statement is true for any non-negative integer less than n. If \(d\mid n\) then

$$\begin{aligned} H_d(n,x)&= xH_d(n-1,x)+(n-1)\cdots (n-d+1)H_d(n-d,x)\\&\equiv x^{1+(n-1)\pmod {d}}(x-1)^{d\left\lfloor \frac{n-1}{d}\right\rfloor }\\&\quad +(d-1)\cdots 1\cdot x^{(n-d)\pmod {d}}(x-1)^{d\left\lfloor \frac{n-d}{d}\right\rfloor }\\&= x^{1+(d-1)}(x-1)^{d\left( \frac{n}{d}-1\right) }+(d-1)!(x-1)^{d\left( \frac{n}{d}-1\right) }\\&\equiv x^d(x-1)^{n-d}-(x-1)^{n-d}=(x^d-1)(x-1)^{n-d}\\&\equiv (x-1)^d(x-1)^{n-d}\\&=(x-1)^n=(x-1)^{d\cdot \left\lfloor \frac{n}{d}\right\rfloor }\pmod {d}. \end{aligned}$$

If \(d\not \mid n\) then, by the recurrence defining polynomials \(H_d(n,x)\), inductive hypothesis for \(n-1\) and the fact that among the numbers \((n-d+1)\), ..., \((n-1)\) there is a one divisible by d, we obtain the following:

$$\begin{aligned} H_d(n,x)&= xH_d(n-1,x)+(n-1)\cdots (n-d+1)H_d(n-d,x)\\&\equiv x^{1+(n-1\pmod {d})}(x-1)^{d\left\lfloor \frac{n-1}{d}\right\rfloor }\equiv x^{n\pmod {d}}(x-1)^{d\left\lfloor \frac{n}{d}\right\rfloor }\pmod {d}. \end{aligned}$$

\(\square \)

Now, we concentrate on the case \(d=2\) and prove the following

Theorem 8.4

Let \(U(n,x)=H_{2}(n-1,x)H_{2}(n+1,x)-H_{2}(n,x)^2\) for \(n\in \mathbb {N}_{+}\).

  1. (1)

    We have \(U(n,x)=V(n,x^2)\), where \(V(n,x)\in \mathbb {Z}[x]\) is of degree \(n-1\).

  2. (2)

    We have \(V(1,x)=1, V(2,x)=x-1, V(3,x)=x^2+3\) and for \(n\ge 4\) the following recurrence relation is true:

    $$\begin{aligned} V(n,x)= & {} (x+n-3)V(n-1,x)+(n-2)(x+n)V(n-2,x)\nonumber \\&-(n-3)(n-2)^2V(n-3,x). \end{aligned}$$
    (16)
  3. (3)

    We have the following identity

    $$\begin{aligned} \mathcal {V}(x,t)=\sum _{n=0}^{\infty }\frac{V(n+1,x)}{n!}t^{n}=\frac{e^{\frac{xt}{1-t}}}{(1+t)\sqrt{1-t^2}}. \end{aligned}$$
  4. (4)

    Let us write \(V(n,x)=\sum _{i=0}^{n-1}a(i,n)x^{i}\). Then

    $$\begin{aligned} \begin{array}{lll} a(0,2n)=V(2n,0)=-\left( \frac{(2n)!}{2^{n}n!}\right) ^{2}, &{} &{}\\ \quad a(0,2n+1)=V(2n+1,0)=\frac{1}{2n+1}\left( \frac{(2n+1)!}{2^{n}n!}\right) ^{2},\\ a(1,2n)=V'(2n,0)=-a(0,2n),\quad a(1,2n+1)=V'(2n+1,0)=0. \end{array} \end{aligned}$$

    and

    $$\begin{aligned} a(i,n)>0 \quad \text{ for } \text{ each }\quad i\in \{2,\ldots ,n-1\}. \end{aligned}$$

Proof

From the expression for \(H_{2}(n,x)\) we see that it is an odd polynomial if \(n\equiv 1\pmod {2}\) and an even polynomial in case of \(n\equiv 0\pmod {2}\). We thus get that the polynomial \(U(n,x)=H_{2}(n-1,x)H_{2}(n+1,x)-H_{2}(n,x)^2\) is an even polynomial and for each \(n\in \mathbb {N}_{+}\) we can write \(U(n,x)=V(n,x^2)\) for some polynomial V(nx). The expressions for V(nx) for \(n\in \{1, 2, 3\}\) are clear from the shape of \(H_{2}(n,x)\) for \(n\in \{1,2,3,4\}\).

Let us observe that the sequence \((H_{2}(n,x))_{n\in \mathbb {N}}\) is a holonomic sequence of polynomials. Indeed, this is consequence of the fact that the generating function \(\mathcal {H}_{d}(x,t)\) (as a function in variable t) is D-finite for each d, i. e. is a solution of some linear differential equation with polynomial coefficients. We recall that a sequence is holonomic if satisfies the recurrence relation with coefficients being polynomials in n. It is well known that if \((f_{n})_{n\in \mathbb {N}}, (g_{n})_{n\in \mathbb {N}}\) are holonomic sequences then the sequences \((f_{n}\pm g_{n})_{n\in \mathbb {N}}, (f_{n}g_{n})_{n\in \mathbb {N}}\) are holonomic too. It is straightforward (but a bit tedious) exercise to check that the sequence \((U(n,x))_{n\in \mathbb {N}_{+}}\) satisfies the relation given in the statement of our theorem (with x replaced by \(x^2\)) and hence the sequence \((V(n,x))_{n\in \mathbb {N}_{+}}\) satisfies exactly the relation presented above.

If we define \(\mathcal {V}(x,t)=\sum _{n=0}^{\infty }\frac{V(n+1,x)}{n!}t^{n}\), then it is an easy task to produce the differential equation satisfied by the function \(\mathcal {V}(x,t)\). Indeed, applying standard methods and the relation (16) we check that

$$\begin{aligned} (1-t)^2(1+t)\frac{\partial \mathcal {V}(x,t)}{\partial t}+((1-3t+2t^2)-(1+t)x)\mathcal {V}(x,t)=0. \end{aligned}$$

The initial condition \(\mathcal {V}(x,0)=1\) allow us to compute the unique solution of the above differential equation in the form

$$\begin{aligned} \mathcal {V}(x,t)=\frac{e^{\frac{xt}{1-t}}}{(1+t)\sqrt{1-t^2}}, \end{aligned}$$

which is exactly the expression presented in the statement of our theorem. Now, it is an easy task to compute the coefficient a(in) for \(i=0,1\). We have \(a(0,1)=1, a(0,2)=-1, a(1,2)=1, a(0,3)=3, a(1,3)=0\) and our formulas are true in case of \(n=1, 2, 3\). We see that the sequence \((a(0,n))_{n\in \mathbb {N}}\) satisfies the recurrence relation of degree 3 given by

$$\begin{aligned} a(0,n)=(n-3)a(0,n-1)+(n-2)na(0,n-2)-(n-3)(n-2)^2a(0,n-3). \end{aligned}$$

The above relation comes from the relation (16) by taking \(x=0\). However, a closer look reveals that our sequence satisfies simpler recurrence relation

$$\begin{aligned} a(0,n)=-a(0,n-1)+(n-1)(n-2)a(0,n-2), \end{aligned}$$

and a direct check shows that the expressions for \(a(0,2n), a(0,2n+1)\) presented in the statement satisfy the above recurrence relation. Similarly, by differentiating the recurrence relation (16) with respect to x and taking the limit \(x\rightarrow 0\) we get that the sequence \((a(1,n))_{n\in \mathbb {N}_{\ge 2}}\) satisfies the recurrence relation

$$\begin{aligned} a(1,n)= & {} a(0,n)+(n-1)a(1,n-1)+(n-2)a(0,n-2)\\&+(n-2)na(1,n-2)-(n-3)^2(n-1)a(1,n-3). \end{aligned}$$

A direct check confirms that the expressions for \(a(1,2n), a(1,2n+1)\) given in the statement are correct. We omit simple details.

Having proved the expressions for a(0, n), a(1, n) we are ready to prove positivity of a(in) for \(i\in \{2,\ldots ,n-1\}\). First, we get rid of the 0-th coefficient in \(V(n+1,x)\) by differentiating this polynomial with respect to x. Thus, by differentiating the generating function \(\mathcal {V}(x,t)\) with respect to x, we arrive to the identity

$$\begin{aligned} \frac{\partial \mathcal {V}(x,t)}{\partial x}=\sum _{n=0}^{\infty }\frac{V'(n+1,x)}{n!}t^{n}=\frac{te^{\frac{xt}{1-t}}}{(1-t^2)\sqrt{1-t^2}}. \end{aligned}$$
(17)

Dividing the last equality by t, comparing expansions on both sides of the above identity, we see that the polynomial \(V'(n+2,x)/(n+1)\) is just the binomial convolution of the integer sequence \((h_{n})_{n\in \mathbb {N}}\) and the sequence of polynomials \((R_{n}(x))_{n\in \mathbb {N}}\), where

$$\begin{aligned} F_{1}(t^2)=\frac{1}{(1-t^2)\sqrt{1-t^2}}=\sum _{n=0}^{\infty }\frac{h_{n}}{n!}t^{2n},\quad \quad F_{2}(x,t)=e^{\frac{xt}{1-t}}=\sum _{n=0}^{\infty }\frac{R_{n}(x)}{n!}t^{n}. \end{aligned}$$

More precisely,

$$\begin{aligned} \frac{V'(n+2,x)}{n+1}=\sum _{i=0}^{\left\lfloor \frac{n}{2}\right\rfloor }\frac{(2i)!}{i!}\left( {\begin{array}{c}n\\ 2i\end{array}}\right) h_{i}R_{n-2i}(x). \end{aligned}$$
(18)

The power series expansion of \(F_{1}(t)\) is well known and we get that

$$\begin{aligned} h_{n}=\frac{(2n+1)!}{2^{2n}n!}. \end{aligned}$$

In consequence, we see that the coefficients of the power series expansion of \(F_{1}(t^2)\) are non-negative. Next, from the definition of \(F_{2}(t)\) we see that \(R_{0}(x)=1\). Moreover, we have that

$$\begin{aligned} \frac{\partial F_{2}(x,t)}{\partial t}=\frac{x}{(1-t)^2}F_{2}(x,t). \end{aligned}$$

The above equality, together with the power series expansion \(1/(1-t)^2=\sum _{n=0}^{\infty }(n+1)t^{n}\) allow us to get the recurrence relation satisfied by the sequence \((R_{n}(x))_{n\in \mathbb {N}}\). Indeed, by comparing the coefficients near \(t^{n}\) we easily get

$$\begin{aligned} R_{n}(x)=x\sum _{i=0}^{n-1}\left( {\begin{array}{c}n\\ i\end{array}}\right) (i+1)!R_{n-1-i}(x). \end{aligned}$$

Let us observe that \(R_{n}(0)=0\) for \(n\ge 1\) and \(x=0\) is a simple root. Indeed, the simplicity of the root \(x=0\) is clear from the relation

$$\begin{aligned} \sum _{n=0}^{\infty }\frac{R_{n}'(x)}{n!}t^{n}=\frac{\partial F_{2}(x,t)}{\partial x}=\frac{t}{1-t}F_{2}(x,t). \end{aligned}$$

Thus, \(R_{n}'(0)=1\) for \(n\ge 1\). Moreover, from the recurrence relation satisfied by the sequence \((R_{n}(x))_{n\in \mathbb {N}}\), it is clear that \({\text {deg}}R_{n}=n\) and by writing \(R_{n}(x)=\sum _{i=0}^{n}b(i,n)x^{i}\) we get \(b(i,n)>0\) for \(i\in \{1,\ldots ,n\}\). Finally, by comparing the coefficients near \(x^{i}, i\in \{1,\ldots ,n-1\}\), on both sides of the formula (18) we get the identity

$$\begin{aligned} \frac{(i+1)a(i+1,n+2)}{n+1}=\sum _{j=0}^{\left\lfloor \frac{n-i}{2}\right\rfloor }\frac{(2j)!}{j!}\left( {\begin{array}{c}n\\ 2j\end{array}}\right) h_{j}b(i,n-2j). \end{aligned}$$
(19)

In consequence \(a(i,n)>0\) for each \(i\in \{1,\ldots ,n-1\}\). \(\square \)

Remark 8.5

Let us note that the sequence of polynomials \((R_{n}(x))_{n\in \mathbb {N}}\) coming from the power series expansion

$$\begin{aligned} e^{\frac{xt}{1-t}}=\sum _{n=0}^{\infty }\frac{R_{n}(x)}{n!}t^{n}, \end{aligned}$$

is also an interesting object. Indeed, if we write \(R_{n}(x)=\sum _{i=0}^{n}b(i,n)x^{i}\), then the double array of coefficients (b(in)), where \(n\in \mathbb {N}\) and \(i\in \{0,\ldots ,n\}\), can be easily found in OEIS database as the sequence A271703 [11]. The sequence is called the unsigned Lah numbers and has closed form \(b(i,n)=\left( {\begin{array}{c}n-1\\ i-1\end{array}}\right) n!/i!\) for \(n\in \mathbb {N}_{+}\) and \(i\in \{1,\ldots ,n-1\}\). It has many combinatorial interpretations. More precisely, the number b(in) counts: (1) partially ordered sets on n elements that consist entirely of k chains; (2) number of ways to split the set \(\{1,\ldots ,n\}\) into an ordered collection of \(n+1-i\) non-crossing nonempty sets; and (3) Dyck n-paths with \(n+1-i\) peaks labeled \(1,2,\ldots , n+1-i\) in some order, see [8]. It would be nice to have combinatorial explanation of the identity (19).

Remark 8.6

The positivity of coefficients of the polynomial V(nx) is a bit unexpected property and the question arises whether similar phenomena hold for the case of \(d\ne 2\). It seems that the direct generalization does not work. However, based on some numerical experiments we are able to formulate the following general

Conjecture 8.7

Let \(d\in \mathbb {N}_{\ge 2}\) and define \(U_{d}(n,x)=H_{d}(n-d,x)H_{d}(n+d,x)-H_{d}(n)^2\). Then, for \(n\ge d\) there is a polynomial \(V_{d}(n,x)\in \mathbb {Z}[x]\) of degree \({\text {deg}}V_{d}(n,x)=2\left\lfloor \frac{n}{d}\right\rfloor -1\) such that

$$\begin{aligned} V_{d}(n,x^{d})=x^{-2(n\pmod {d})}U_{d}(n,x) \end{aligned}$$

and all coefficients of \(V_{d}(n,x)\) are positive. In particular, for each \(d\in \mathbb {N}_{\ge 2}\) and \(n\ge d\) we have

$$\begin{aligned} H_{d}(n-d)H_{d}(n+d)\ge H_{d}(n)^2. \end{aligned}$$

It is possible to prove the above conjecture in the case \(d=2\) by using the same approach as in the proof of Theorem 8.4. More precisely, one can prove the identity

$$\begin{aligned} \mathcal {V}_{2}(x,t)=\frac{2 e^{\frac{tx}{1-t}} (2x+1-t)}{(1-t)(1-t^2) \sqrt{1-t^2}}=\sum _{n=0}^{\infty }\frac{U_{2}(n,\sqrt{x})}{n!}t^{n}, \end{aligned}$$

and careful analysis of the convolution form of the polynomial \(U_{2}(n,\sqrt{x})\) allows to prove that if \(n\equiv 1\pmod {2}\), then all coefficients but 0th are positive; in case of \(n\equiv 0\pmod {2}\) all coefficients are positive. However, it seems that this approach can not be used in order to get the positivity of the coefficients of the polynomial \(V_{d}(n,x)\) (or equivalently, the non-negativity of coefficients of the polynomial \(U_{d}(n,x)\)).

It is clear that our discussion is connected with the concept of concavity of sequences. More precisely, let us recall that the sequence \(\mathbf{a}=(a_{n})_{n\in \mathbb {N}}\) is called logarithmically concave sequence, or a log-concave sequence for short, if \(a_{n}^2\ge a_{n-1}a_{n+1}\) holds for all \(n\ge k\) for some k. If the opposite inequality is satisfied for \(n\ge k\), then the sequence is called logarithmically convex (log-convex for short). Let us observe that if the sequence \(\mathbf{a}\) is positive, then the log-concavity of \(\mathbf{a}\) implies the log-convexity of the sequence \(\mathbf{a}^{-1}=(a_{n}^{-1})_{n\in \mathbb {N}}\) (and vice-versa of course). As an immediate consequence of Theorem 8.4, we get the following

Proposition 8.8

If \(x\ge 1\), then the sequence \((H_{2}(n,x))_{n\in \mathbb {N}}\) is log-convex. In particular, we have

$$\begin{aligned} H_{2}(n)^2\le H_{2}(n-1)H_{2}(n+1) \end{aligned}$$

and the sequence \((H_{2}(n))_{n\in \mathbb {N}}\) is log-convex.

Let us note that from the work of Bender and Canfield [2] we know that for each \(d\in \mathbb {N}_{\ge 2}\) and any given \(x>0\), there is an integer \(N_{d}(x)\) such that the sequence \((H_{d}(n,x))_{n\ge N_{d}(x)}\) is log-convex. However, the question concerning the non-negativity of coefficients of the polynomial \(U_{d}(n,x)\) is of different nature. In fact, it is not even clear whether for given positive x, the inequality \(U_{d}(n,x)\ge 0\) is true.

One can also note that the non-zero coefficients of the polynomial \(U_{2}(n,x)\) are not too small. Indeed, this is a consequence of the following

Proposition 8.9

Let \(d\in \mathbb {N}_{\ge 2}\) be fixed. Then, for \(n\ge d\), the following congruence is true

$$\begin{aligned} H_{d}(n-d,x)H_{d}(n+d,x)\equiv H_{d}(n,x)^2\pmod {(d-1)!}. \end{aligned}$$

Proof

The proof of the above congruence can be performed with the help of the basic recurrence relation satisfied by the sequence \((H_{d}(n,x))_{n\in \mathbb {N}}\) and the induction. We left the details for the reader. \(\square \)

In fact, the following stronger result is true.

Theorem 8.10

Let \(d\in \mathbb {N}_{\ge 2}\). Then

$$\begin{aligned}&H_{d}(n-d,x)H_{d}(n+d,x)\equiv H_{d}(n,x)^2\pmod {d!},\\&\quad n\ge d\quad \Leftrightarrow \quad d=p\quad \text{ or }\quad d=p^2\quad \text{ for }\quad p\in {\mathbb {P}}. \end{aligned}$$

Proof

If d is a prime number then by Theorem 8.3 we have

$$\begin{aligned} H_d(n-d,x)H_d(n+d,x)\equiv x^{2(n\pmod {d})}(x-1)^{2d\left\lfloor \frac{n}{d}\right\rfloor }\equiv H_d(n,x)^2\pmod {d}, \end{aligned}$$

which combined with the congruence \(H_d(n-d,x)H_d(n+d,x)\equiv H_d(n,x)^2\pmod {(d-1)!}\) and the fact that d and \((d-1)!\) are coprime, gives the congruence \(H_d(n-d,x)H_d(n+d,x)\equiv H_d(n,x)^2\pmod {d!}\) for each integer \(n\ge d\).

If d is a composite number then at first we show the equivalence of the condition

$$\begin{aligned} H_d(n-d,x)H_d(n+d,x)\equiv H_d(n,x)^2\pmod {d!}, \quad n\ge d \end{aligned}$$

with the condition

$$\begin{aligned} 2{2d-1\atopwithdelims ()d-1}&\equiv 2\pmod {d} \text{ and } {n-d\atopwithdelims ()d-1}+{n+d\atopwithdelims ()d-1}\nonumber \\&\equiv 2{n\atopwithdelims ()d-1}\pmod {d},\quad n\ge d. \end{aligned}$$
(20)

For \(n=d\) we have the following chain of equivalences:

$$\begin{aligned}&H_d(0,x)H_d(2d,x)\equiv H_d(d,x)^2\pmod {d!}\nonumber \\&\quad \Leftrightarrow 1\cdot \left( x^{2d}+\frac{(2d)_{(d)}}{d}x^d+\frac{(2d)_{(2d)}}{2d^2}\right) \equiv \left( x^d+\frac{(d)_{(d)}}{d}\right) ^2\pmod {d!}\nonumber \\&\quad \Leftrightarrow x^{2d}+2(2d-1)_{(d-1)}x^d+(2d-1)_{(d-1)}(d-1)!\nonumber \\&\quad \equiv x^{2d}+2(d-1)!x^d+((d-1)!)^2\pmod {d!}\nonumber \\&\quad \Leftrightarrow 2(2d-1)_{(d-1)}x^d+(2d-1)_{(d-1)}(d-1)!\nonumber \\&\quad \equiv 2(d-1)!x^d+((d-1)!)^2\pmod {d!}\nonumber \\&\quad \Leftrightarrow 2{2d-1\atopwithdelims ()d-1}x^d+(2d-1)_{(d-1)}\equiv 2x^d+(d-1)!\pmod {d}.\nonumber \\ \end{aligned}$$
(21)

Since \((2d-1)_{(d-1)}\equiv (d-1)!\pmod {d}\) for any positive integer d, thus the last congruence is equivalent to \(2{2d-1\atopwithdelims ()d-1}\equiv 2\pmod {d}\). Now, let us assume that \(n\ge d>4\) and \(H_d(n-d,x)H_d(n+d,x)\equiv H_d(n,x)^2\pmod {d!}\). Then we have the following chain of equivalences:

$$\begin{aligned}&H_d(n+1-d,x)H_d(n+1+d,x)\equiv H_d(n+1,x)^2\pmod {d!}\nonumber \\&\quad \Leftrightarrow (xH_d(n-d,x)+(n-d)_{(d-1)}H_d(n-2d+1,x))(xH_d(n+d,x)\nonumber \\&\qquad +(n+d)_{(d-1)}H_d(n+1,x))\nonumber \\&\quad \equiv ((xH_d(n,x)+(n)_{(d-1)}H_d(n-d+1,x))^2\pmod {d!}\nonumber \\&\quad \Leftrightarrow x^2H_d(n-d,x)H_d(n+d,x)+x(n-d)_{(d-1)}H_d(n-2d+1,x)H_d(n+d,x)\nonumber \\&\qquad +x(n+d)_{(d-1)}H_d(n-d,x)H_d(n+1,x)+(n-d)_{(d-1)}(n+d)_{(d-1)}\nonumber \\&\qquad H_d(n-2d+1,x)H_d(n+1,x)\nonumber \\&\quad \equiv x^2H_d(n,x)^2+2x(n)_{(d-1)}H_d(n-d+1,x)H_d(n,x)\nonumber \\&\qquad +(n)_{(d-1)}^2H_d(n-d+1,x)^2\pmod {d!}\nonumber \\&\quad \Leftrightarrow x(n-d)_{(d-1)}H_d(n-2d+1,x)H_d(n+d,x)\nonumber \\&\qquad +x(n+d)_{(d-1)}H_d(n-d,x)H_d(n+1,x)\nonumber \\&\qquad +(n-d)_{(d-1)}(n+d)_{(d-1)}H_d(n-2d+1,x)H_d(n+1,x)\nonumber \\&\quad \equiv 2x(n)_{(d-1)}H_d(n-d+1,x)H_d(n,x)+(n)_{(d-1)}^2H_d(n-d+1,x)^2\pmod {d!}\nonumber \\&\quad \Leftrightarrow x{n-d\atopwithdelims ()d-1}H_d(n-2d+1,x)H_d(n+d,x)\nonumber \\&\qquad +x{n+d\atopwithdelims ()d-1}H_d(n-d,x)H_d(n+1,x)\nonumber \\&\qquad +{n-d\atopwithdelims ()d-1}(n+d)_{(d-1)}H_d(n-2d+1,x)H_d(n+1,x)\nonumber \\&\quad \equiv 2x{n\atopwithdelims ()d-1}H_d(n-d+1,x)H_d(n,x)\nonumber \\&\qquad +{n\atopwithdelims ()d-1}(n)_{(d-1)}H_d(n-d+1,x)^2\pmod {d}\nonumber \\&\quad \Leftrightarrow x{n-d\atopwithdelims ()d-1}H_d(n-2d+1,x)H_d(n+d,x)\nonumber \\&\qquad +x{n+d\atopwithdelims ()d-1}H_d(n-d,x)H_d(n+1,x)\nonumber \\&\quad \equiv 2x{n\atopwithdelims ()d-1}H_d(n-d+1,x)H_d(n,x)\pmod {d}\nonumber \\&\quad \Leftrightarrow x{n-d\atopwithdelims ()d-1}x^{n-2d+1}x^{n+d}+x{n+d\atopwithdelims ()d-1}x^{n-d}x^{n+1}\nonumber \\&\quad \equiv 2x{n\atopwithdelims ()d-1} x^{n-d+1}x^{n}\pmod {d}\nonumber \\&\quad \Leftrightarrow \left( {n-d\atopwithdelims ()d-1}+{n+d\atopwithdelims ()d-1}\right) x^{2n-d+2}\equiv 2{n\atopwithdelims ()d-1} x^{2n-d+2}\pmod {d}\nonumber \\&\quad \Leftrightarrow {n-d\atopwithdelims ()d-1}+{n+d\atopwithdelims ()d-1}\equiv 2{n\atopwithdelims ()d-1}\pmod {d}, \end{aligned}$$
(22)

where we used Theorem 8.3 and the fact that a composite number \(d\ge 6\) divides a product of any consecutive \(d-1\) integers.

Assume that \(d=p^2\) for some odd prime number p. Then

$$\begin{aligned} 2{2p^2-1\atopwithdelims ()p^2-1}&=2\prod _{j=1}^{p^2-1}\frac{p^2+j}{j}=2\prod _{j=1,p\not \mid j}^{p^2-1}\frac{p^2+j}{j}\cdot \prod _{j=1}^{p-1}\frac{p^2+jp}{jp}\\&=2\prod _{j=1,p\not \mid j}^{p^2-1}\frac{p^2+j}{j}\cdot \prod _{j=1}^{p-1}\left( 1+\frac{p}{j}\right) \\&\equiv 2\prod _{j=1,p\not \mid j}^{p^2-1}\frac{j}{j}\cdot \left( 1+p\sum _{j=1}^{p-1}\frac{1}{j}\right) \equiv 2\left( 1+p\sum _{j=1}^{p-1}j\right) \\&=2\left( 1+\frac{p^2(p-1)}{2}\right) \equiv 2\pmod {p^2}. \end{aligned}$$

In order to prove the congruence \({n-p^2\atopwithdelims ()p^2-1}+{n+p^2\atopwithdelims ()p^2-1}\equiv 2{n\atopwithdelims ()p^2-1}\pmod {p^2}\) for \(n\ge p^2\) we will compute \({n\atopwithdelims ()p^2-1}\) modulo \(p^2\). If \(p^2\mid n+1\) then, similarly as above, we prove that \({n\atopwithdelims ()p^2-1}\equiv 1\pmod {p^2}\). If \(\nu _p(n+1)=1\) then we write \(n+1=kp^2+lp\) for some \(k,l\in \mathbb {N}_+\) with \(l<p\) and compute

$$\begin{aligned} {n\atopwithdelims ()p^2-1}&={kp^2+lp-1\atopwithdelims ()p^2-1}=\frac{kp^2}{lp}\prod _{j=1}^{lp-1}\frac{kp^2+j}{j}\cdot \prod _{j=lp+1}^{p^2-1}\frac{(k-1)p^2+j}{j}\\&=\frac{kp}{l}\prod _{j=1, p\not \mid j}^{lp-1}\frac{kp^2+j}{j}\cdot \prod _{j=1}^{l-1}\frac{kp^2+jp}{jp}\\&\quad \cdot \prod _{j=lp+1, p\not \mid j}^{p^2-1}\frac{(k-1)p^2+j}{j}\cdot \prod _{j=l+1}^{p-1}\frac{(k-1)p^2+jp}{jp}\\&=\frac{kp}{l}\prod _{j=1, p\not \mid j}^{lp-1}\frac{kp^2+j}{j}\cdot \prod _{j=1}^{l-1}\frac{kp+j}{j}\\&\quad \cdot \prod _{j=lp+1, p\not \mid j}^{p^2-1}\frac{(k-1)p^2+j}{j}\cdot \prod _{j=l+1}^{p-1}\frac{(k-1)p+j}{j}\\&\equiv \frac{kp}{l}\prod _{j=1}^{l-1}\frac{kp+j}{j}\cdot \prod _{j=l+1}^{p-1}\frac{(k-1)p+j}{j}\equiv \frac{kp}{l}\prod _{j=1, j\ne l}^{p-1}\frac{j}{j}=\frac{kp}{l}\pmod {p^2}. \end{aligned}$$

If \(p\not \mid n+1\) then we write \(n+1=kp^2+lp+m\) for some \(k,m\in \mathbb {N}_+\) and \(l\in \mathbb {N}\) with \(l,m<p\) and compute

$$\begin{aligned} {n\atopwithdelims ()p^2-1}&={kp^2+lp+m-1\atopwithdelims ()p^2-1}\\&=\frac{kp^2}{lp+m}\prod _{j=1}^{lp+m-1}\frac{kp^2+j}{j}\cdot \prod _{j=lp+m+1}^{p^2-1}\frac{(k-1)p^2+j}{j}\\&=\frac{kp^2}{lp+m}\prod _{j=1, p\not \mid j}^{lp+m-1}\frac{kp^2+j}{j}\cdot \prod _{j=1}^{l}\frac{kp^2+jp}{jp}\\&\quad \cdot \prod _{j=lp+m+1, p\not \mid j}^{p^2-1}\frac{(k-1)p^2+j}{j}\cdot \prod _{j=l+1}^{p-1}\frac{(k-1)p^2+jp}{jp}\\&=\frac{kp^2}{lp+m}\prod _{j=1, p\not \mid j}^{lp+m-1}\frac{kp^2+j}{j}\cdot \prod _{j=1}^{l}\frac{kp+j}{j}\cdot \prod _{j=lp+m+1, p\not \mid j}^{p^2-1}\frac{(k-1)p^2+j}{j}\\&\quad \cdot \prod _{j=l+1}^{p-1}\frac{(k-1)p+j}{j}\equiv 0\pmod {p^2}. \end{aligned}$$

Thus, independently on the p-adic valuation of \(n+1\), there holds \({n-p^2\atopwithdelims ()p^2-1}+{n+p^2\atopwithdelims ()p^2-1}\equiv 2{n\atopwithdelims ()p^2-1}\pmod {p^2}\). The only non-trivial case is \(\nu _p(n+1)=1\). Then, writing \(n+1=kp^2+lp\) for some \(k,l\in \mathbb {N}_+\) with \(l<p\), we obtain the following:

$$\begin{aligned} {n-p^2\atopwithdelims ()p^2-1}+{n+p^2\atopwithdelims ()p^2-1}&={(k-1)p^2+lp-1\atopwithdelims ()p^2-1}+{(k+1)p^2+lp-1\atopwithdelims ()p^2-1}\\&\equiv \frac{(k-1)p}{l}+\frac{(k+1)p}{l}=\frac{2kp}{l}\equiv 2{kp^2+lp-1\atopwithdelims ()p^2-1}\\&\equiv 2{n\atopwithdelims ()p^2-1}\pmod {p^2}. \end{aligned}$$

We have just proven the validity of congruences (20) for d being a square of an odd prime number.

In the sequel, we assume that d is a composite number not being a square of any odd prime number and satisfying congruences \(H_{d}(n-d,x)H_{d}(n+d,x)\equiv H_{d}(n,x)^2\pmod {d!}\), \(n\ge d\). Let us note that if congruences \({n-d\atopwithdelims ()d-1}+{n+d\atopwithdelims ()d-1}\equiv 2{n\atopwithdelims ()d-1}\pmod {d}\) hold for each integer \(n\ge d\) then, by the identity \({n+1\atopwithdelims ()c+1}-{n\atopwithdelims ()c+1}={n\atopwithdelims ()c}\), the congruences \({n-d\atopwithdelims ()c}+{n+d\atopwithdelims ()c}\equiv 2{n\atopwithdelims ()c}\pmod {d}\) are satisfied for each integers \(n\ge d\) and \(c\in \{0,\ldots ,d-1\}\). We have the following chain of congruences:

$$\begin{aligned}&{n-d\atopwithdelims ()c}+{n+d\atopwithdelims ()c}\equiv 2{n\atopwithdelims ()c}\pmod {d}\\&\quad \Leftrightarrow \frac{1}{c!}\left( (n-d)_{(c)}+(n+d)_{(c)}\right) \equiv \frac{2(n)_{(c)}}{c!}\pmod {d}\\&\quad \Leftrightarrow \frac{1}{c!}\left( \sum _{k=0}^c (-d)^k\sum _{0\le j_1<\cdots<j_{c-k}\le c-1}(n-j_1)\cdots (n-j_{c-k})\right. \\&\qquad \left. +\sum _{k=0}^c d^k\sum _{0\le j_1<\cdots<j_{c-k}\le c-1}(n-j_1)\cdots (n-j_{c-k})\right) \equiv \frac{2(n)_{(c)}}{c!}\pmod {d}\\&\quad \Leftrightarrow \frac{2}{c!}\sum _{k=0}^{\left\lfloor \frac{c}{2}\right\rfloor } d^{2k}\sum _{0\le j_1<\cdots<j_{c-2k}\le c-1}(n-j_1)\cdots (n-j_{c-2k})\equiv \frac{2(n)_{(c)}}{c!}\pmod {d}\\&\quad \Leftrightarrow \frac{2}{c!}\sum _{k=1}^{\left\lfloor \frac{c}{2}\right\rfloor } d^{2k}\sum _{0\le j_1<\cdots <j_{c-2k}\le c-1}(n-j_1)\cdots (n-j_{c-2k})\equiv 0\pmod {d}. \end{aligned}$$

Assume now that d is a composite number not of the form 2p, \(2p^2\) for some odd prime number p or \(2^k\) for some integer \(k\ge 2\). Then there is an odd prime number p such that \(d=tp^s\), where \(s\in \mathbb {N}_+\) and \(t\ge 3\) is an integer with p-adic valuation less than s. Taking \(c=2p^s\) and \(n=p^d-1\) in the expression \(\frac{2}{c!}\sum _{k=1}^{\left\lfloor \frac{c}{2}\right\rfloor } d^{2k}\sum _{0\le j_1<\cdots <j_{c-2k}\le c-1}(n-j_1)\cdots (n-j_{c-2k})\), we obtain

$$\begin{aligned}&\frac{2}{(2p^s)!}\sum _{k=1}^{p^s} (tp^s)^{2k}\sum _{0\le j_1<\cdots<j_{c-2k}\le c-1}(p^d-1-j_1)\cdots (p^d-1-j_{c-2k})\\&\quad =\frac{1}{(2p^s-1)_{(p^s-1)}(p^s-1)!}\sum _{k=1}^{p^s} t^{2k}p^{2s(k-1)}\\&\qquad \sum _{0\le j_1<\cdots <j_{c-2k}\le c-1}(p^d-1-j_1)\cdots (p^d-1-j_{c-2k}). \end{aligned}$$

Since \(d>s\), we have \(\nu _p(p^d-1-i)=\nu _p(1+i)\) for any \(i\in \{0,\ldots ,2p^s-1\}\). Hence, the summand with the least p-adic valuation is

$$\begin{aligned} \frac{1}{(2p^s-1)_{(p^s-1)}(p^s-1)!}t^2(p^d-1)_{(p^s-1)}(p^d-p^s-1)_{(p^s-1)}, \end{aligned}$$

obtained for \(k=1\), \(j_i=i-1\), \(i\in \{1,\ldots ,p^s\}\), and \(j_i=i\), \(i\in \{p^s+1,\ldots ,2p^s-2\}\). By the equality \(\nu _p(p^d-1-i)=\nu _p(1+i)\) for any \(i\in \{0,\ldots ,2p^s-1\}\) this summand has p-adic valuation equal to \(2\nu _p(t)<s+\nu _p(t)=\nu _p(d)\). Any other summand has strictly greater p-adic valuation because some from the factors \(p^d-1,\ldots ,p^d-p^s+1,p^d-p^s-1,\ldots ,p^d-2p^s+1\), having p-adic valuations less than s, are replaced by \(p^d-p^s\), \(p^d-2p^s\) or \(d=tp^s\) with p-adic valuations at least equal to s. Thus, the whole sum \(\frac{1}{(2p^s-1)_{(p^s-1)}(p^s-1)!}\sum _{k=1}^{p^s} t^{2k}p^{2s(k-1)}\sum _{0\le j_1<\cdots <j_{c-2k}\le c-1}(p^d-1-j_1)\cdots (p^d-1-j_{c-2k})\) has p-adic valuation less than \(\nu _p(d)\), which implies that it cannot be divisible by d—a contradiction.

We are checking now the numbers d of the form 2p, \(2p^2\) for some odd prime number p. We compute the value \({2d-1\atopwithdelims ()d-1}\pmod {p}\). For shortening the proof we will perform the computation for numbers \(d=2p^2\) as for the remaining case the computations are simpler.

$$\begin{aligned} {4p^2-1\atopwithdelims ()2p^2-1}&=\prod _{j=1}^{2p^2-1}\frac{2p^2+j}{j}=\prod _{j=1, p\not \mid j}^{2p^2-1}\frac{2p^2+j}{j}\cdot \prod _{j=1, p\not \mid j}^{2p-1}\frac{2p^2+jp}{jp}\cdot \frac{3p^2}{p^2}\\&=\prod _{j=1, p\not \mid j}^{2p^2-1}\frac{2p^2+j}{j}\cdot \prod _{j=1, p\not \mid j}^{2p-1}\frac{2p+j}{j}\cdot 3\equiv \prod _{j=1, p\not \mid j}^{2p^2-1}\frac{j}{j}\cdot \prod _{j=1, p\not \mid j}^{2p-1}\frac{j}{j}\cdot 3\\&\equiv 3\pmod {p} \end{aligned}$$

Then \(2{4p^2-1\atopwithdelims ()2p^2-1}\equiv 6\pmod {p}\) but, on the other hand, there should be \(2{4p^2-1\atopwithdelims ()2p^2-1}\equiv 2\pmod {p}\). This implies the congruence \(6\equiv 2\pmod {p}\) and, as a result, \(p\mid 4\)—a contradiction, as p is an odd prime number.

Let \(d=2^k\) for an integer \(k\ge 3\). We compute the value \({2d-1\atopwithdelims ()d-1}\pmod {p}\):

$$\begin{aligned} {2^{k+1}-1\atopwithdelims ()2^k-1}&=\prod _{j=1}^{2^k-1}\frac{2^k+j}{j}=\frac{3\cdot 2^{k-1}}{2^{k-1}}\cdot \frac{5\cdot 2^{k-2}}{2^{k-2}}\cdot \frac{7\cdot 2^{k-2}}{3\cdot 2^{k-2}}\prod _{l=0}^{k-3}\prod _{j=1, 2\not \mid j}^{2^{k-l}-1}\frac{2^k+2^lj}{2^lj}\\&=3\cdot 5\cdot \frac{7}{3}\prod _{l=0}^{k-3}\prod _{j=1, 2\not \mid j}^{2^{k-l}-1}\frac{2^{k-l}+j}{j}\equiv 35\prod _{l=0}^{k-3}\prod _{j=1, 2\not \mid j}^{2^{k-l}-1}\frac{j}{j}\equiv 3\pmod {8}. \end{aligned}$$

Then \(2{2^{k+1}-1\atopwithdelims ()2^k-1}\equiv 6\pmod {8}\) but, on the other hand, there should be \(2{2^{k+1}-1\atopwithdelims ()2^k-1}\equiv 2\pmod {8}\). This implies the congruence \(6\equiv 2\pmod {8}\) and, as a result, \(8\mid 4\)—a contradiction.

We are left with the case \(d=4\). By (21), the condition \(H_4(0,x)H_4(8,x)\equiv H_4(4,x)^2\pmod {4!}\) is equivalent to the condition \(2{7\atopwithdelims ()3}\equiv 2\pmod {4}\), which holds. It is easy to compute that

$$\begin{aligned} {n\atopwithdelims ()3}\equiv {\left\{ \begin{array}{ll} 2\left\lfloor \frac{n}{4}\right\rfloor +1, &{}\quad \text{ if } 4\mid n+1\\ 2, &{}\quad \text{ if } \nu _2(n-1)=2\\ 0, &{}\quad \text{ if } \nu _2(n+1)=0 \text{ or } 8\mid n-1 \end{array}\right. } \pmod {4}. \end{aligned}$$
(23)

Assuming that \(H_4(n-4,x)H_4(n+4,x)\equiv H_4(n,x)^2\pmod {4!}\), we prove similarly as in (22) that the congruence \(H_4(n-3,x)H_4(n+5,x)\equiv H_4(n+1,x)^2\pmod {4!}\) is equivalent to

$$\begin{aligned}&x{n-4\atopwithdelims ()3}H_4(n-7,x)H_4(n+4,x)+x{n+4\atopwithdelims ()3}H_4(n-4,x)H_4(n+1,x)\\&\qquad +{n-4\atopwithdelims ()3}(n+4)_{(3)}H_4(n-7,x)H_4(n+1,x)\\&\quad \equiv 2x{n\atopwithdelims ()3}H_4(n-3,x)H_4(n,x)+{n\atopwithdelims ()3}(n)_{(3)}H_4(n-3,x)^2\pmod {4}. \end{aligned}$$

Further, the above condition is equivalent to the following equivalent congruences:

$$\begin{aligned}&x{n-4\atopwithdelims ()3}\left( x^{n-7}+2\left\lfloor \frac{n-7}{4}\right\rfloor x^{n-11}\right) \left( x^{n+4}+2\left\lfloor \frac{n+4}{4}\right\rfloor x^{n}\right) \\&\qquad +x{n+4\atopwithdelims ()3}\left( x^{n-4}+2\left\lfloor \frac{n-4}{4}\right\rfloor x^{n-8}\right) \left( x^{n+1}+2\left\lfloor \frac{n+1}{4}\right\rfloor x^{n-3}\right) \\&\qquad +{n-4\atopwithdelims ()3}(n+4)_{(3)}\left( x^{n-7}+2\left\lfloor \frac{n-7}{4}\right\rfloor x^{n-11}\right) \left( x^{n+1}+2\left\lfloor \frac{n+1}{4}\right\rfloor x^{n-3}\right) \\&\quad \equiv 2x{n\atopwithdelims ()3}\left( x^{n-3}+2\left\lfloor \frac{n-3}{4}\right\rfloor x^{n-7}\right) \left( x^{n}+2\left\lfloor \frac{n}{4}\right\rfloor x^{n-4}\right) \\&\qquad +{n\atopwithdelims ()3}(n)_{(3)}\left( x^{n-3}+2\left\lfloor \frac{n-3}{4}\right\rfloor x^{n-7}\right) ^2\pmod {4}\\&\quad \Leftrightarrow {n-4\atopwithdelims ()3}\left[ x^{2n-2}+2\left( \left\lfloor \frac{n-7}{4}\right\rfloor +\left\lfloor \frac{n+4}{4}\right\rfloor \right) x^{2n-6}\right] \\&\qquad +{n+4\atopwithdelims ()3}\left[ x^{2n-2}+2\left( \left\lfloor \frac{n-4}{4}\right\rfloor +\left\lfloor \frac{n+1}{4}\right\rfloor \right) x^{2n-6}\right] \\&\qquad +{n-4\atopwithdelims ()3}(n+4)_{(3)}\left[ x^{2n-6}+2\left( \left\lfloor \frac{n-7}{4}\right\rfloor +\left\lfloor \frac{n+1}{4}\right\rfloor \right) x^{2n-10}\right] \\&\quad \equiv 2{n\atopwithdelims ()3}\left[ x^{2n-2}+2\left( \left\lfloor \frac{n-3}{4}\right\rfloor +\left\lfloor \frac{n}{4}\right\rfloor \right) x^{2n-6}\right] +{n\atopwithdelims ()3}(n)_{(3)}x^{2n-6}\pmod {4}. \end{aligned}$$

The last congruence is true, because \(2\left( \left\lfloor \frac{n-7}{4}\right\rfloor +\left\lfloor \frac{n+4}{4}\right\rfloor \right) \equiv 2\left( \left\lfloor \frac{n-4}{4}\right\rfloor +\left\lfloor \frac{n+1}{4}\right\rfloor \right) \equiv 2\left( \left\lfloor \frac{n-3}{4}\right\rfloor +\left\lfloor \frac{n}{4}\right\rfloor \right) \pmod {4}\), \(\left( \left\lfloor \frac{n-7}{4}\right\rfloor +\left\lfloor \frac{n+1}{4}\right\rfloor \right) \equiv 0\pmod {2}\) and by (23) we have \({n-4\atopwithdelims ()3}+{n+4\atopwithdelims ()3}\equiv 2{n\atopwithdelims ()3}\pmod {4}\) and \({n-4\atopwithdelims ()3}(n+4)_{(3)}\equiv {n\atopwithdelims ()3}(n)_{(3)}\pmod {4}\). Hence, \(H_4(n-4,x)H_4(n+4,x)\equiv H_4(n,x)^2\pmod {4!}\) for each integer \(n\ge 4\). \(\square \)

Two further identities involving elements of the sequence \((H_{d}(n,x))_{n\in \mathbb {N}}\) can be proved. More precisely, we have the following:

Theorem 8.11

Let \(d\in \mathbb {N}_{\ge 2}\) be given. For each \(n\in \mathbb {N}\) the following identities hold

$$\begin{aligned}&H_{d}(n+d,x)H_{d}(n+d-2,x)-H_{d}(n+d-1,x)^2\\&\quad =(n+d-3)_{(d-3)}(H_{d}(n,x)H_{d}'(n+d-1,x)\\&\qquad -H_{d}(n+d-1,x)H_{d}'(n,x)),\\&H_{d}(n,x)H_{d}''(n+2,x)-H_{d}'(n+2,x)H_{d}''(n,x)\\&\quad =(n+2)(H_{d}(n,x)H_{d}''(n+1,x)\\&\qquad -H_{d}(n+1,x)H_{d}''(n,x). \end{aligned}$$

9 Some related observations, questions and conjectures

In this section we collect observations concerning some related sequences connected with the family of sequences \((H_{d}(n))_{n\in \mathbb {N}}\) and formulate several questions and conjectures appeared during our investigations.

In [1] the authors introduced the summatory sequence for the sequence of involutions \((H_{2}(n))_{n\in \mathbb {N}}\). Thus, it is natural to consider the sequence \((G_{d}(n))_{n\in \mathbb {N}}\) for \(d\in \mathbb {N}_{\ge 2}\) with

$$\begin{aligned} G_{d}(n)=\sum _{i=0}^{n}H_{d}(i). \end{aligned}$$

From the definition, the number \(G_{d}(n)\) can be seen as a number of all permutations in \(\coprod _{i=1}^{n}S_{i}\) which are products of cycles of length d.

Let us recall the following useful result.

Lemma 9.1

(Lemma 5.2 in [1]) If \(A(x)=\sum _{n=0}^{\infty }\frac{a_{n}}{n!}x^{n}\) and \(s_{n}=\sum _{i=0}^{n}a_{i}\) then

$$\begin{aligned} \sum _{n=0}^{\infty }\frac{s_{n}}{n!}x^{n}=A(x)+e^{x}\int _{0}^{x}e^{-t}A(t)dt. \end{aligned}$$

We are ready to prove the following

Theorem 9.2

  1. (1)

    We have

    $$\begin{aligned} \mathcal {G}_{d}(x)=\sum _{n=0}^{\infty }\frac{G_{d}(n)}{n!}x^{n}=\mathcal {H}_{d}(x)+e^{x}\int _{0}^{x}e^{\frac{t^{d}}{d}}dt. \end{aligned}$$
  2. (2)

    The sequence \((G_{d}(n))_{n\in \mathbb {N}}\) satisfies the following recurrence relation: \(G_{d}(i)=i+1\) for \(i=-1,\ldots , d-1\), and for \(n\ge d\) we have

    $$\begin{aligned} G_{d}(n)= & {} 2G_{d}(n-1)+G_{d}(n-2)\nonumber \\&+(n-1)_{(d-1)}(G_{d}(n-d)-G_{d}(n-d-1)). \end{aligned}$$
    (24)

Proof

In order to get the exponential generating function for the sequence \((G_{d}(n))_{n\in \mathbb {N}}\) we apply Lemma 9.1 with \(A(x)=\mathcal {H}_{d}(x)\) and get the result.

The recurrence relation for the sequence \((G_{d}(n))_{n\in \mathbb {N}}\) can be easily proved by noting the identity \(H_{d}(n)=G_{d}(n)-G_{d}(n-1)\). Indeed, from the relation (1) we get

$$\begin{aligned}&G_{d}(n)-G_{d}(n-1)=G_{d}(n-1)-G_{d}(n-2)\\&\quad +(n-1)_{(d-1)}(G_{d}(n-d)-G_{d}(n-d-1)) \end{aligned}$$

and hence the result. \(\square \)

We can apply the previous result and get the following general fact (with special case for \(d=2\) obtained by Amdeberhan and Moll).

Corollary 9.3

We have the following identity:

$$\begin{aligned} \sum _{i=0}^{n}(-1)^{n-i}\left( {\begin{array}{c}n\\ i\end{array}}\right) G_{d}(i-1)= {\left\{ \begin{array}{ll} \begin{array}{ll} 0, &{}\quad \text{ if } n\not \equiv 1\pmod {d}\\ \frac{(md)!}{d^{m}m!},&{}\quad \text{ if } n=dm+1 \end{array} \end{array}\right. }. \end{aligned}$$

Proof

We have \(\mathcal {H}_{d}(x)=e^{x+\frac{x^{d}}{d}}\) and using the first part of Theorem 9.2 we get

$$\begin{aligned} \int _{0}^{x}e^{\frac{t^{d}}{d}}dt= & {} e^{-x}(\mathcal {G}_{d}(x)-\mathcal {H}_{d}(x))=e^{-x}\sum _{n=1}^{\infty }\frac{G_{d}(n-1)}{n!}x^{n}\\= & {} \sum _{n=0}^{\infty }\left( \sum _{i=0}^{n}(-1)^{n-i}\left( {\begin{array}{c}n\\ i\end{array}}\right) G_{d}(i-1)\right) \frac{x^{n}}{n!}. \end{aligned}$$

Comparing the coefficients on both sides of the first and the last expression we get the result. \(\square \)

In the paper [1] the authors were able to compute exact expression for the 2-adic valuation of \(G_{2}(n)\). One can ask whether it is possible to compute \(\nu _{p}(G_{p}(n))\) for \(p\in {\mathbb {P}}\) and \(n\in \mathbb {N}_{+}\). A numerical computations suggest the following:

Conjecture 9.4

  1. (1)

    We have the following expression

    $$\begin{aligned} \nu _{3}(G_{3}(9n+k))={\left\{ \begin{array}{ll} \begin{array}{ll} 2n &{}\quad \text{ for }\;k=0,1,\\ 2n+1 &{}\quad \text{ for }\;k=2,3,4,\\ 2n+2 &{}\quad \text{ for }\;k=5,6,7,\\ 2n+5+\nu _{3}(n+1) &{}\quad \text{ for }\;k=8. \end{array} \end{array}\right. } \end{aligned}$$
  2. (2)

    We have the following expression

    $$\begin{aligned} \nu _{5}(G_{5}(25n+k))={\left\{ \begin{array}{ll} \begin{array}{ll} 4n &{}\quad \text{ for }\;k=0,1,2,3,\\ 4n+1 &{}\quad \text{ for }\;k=4,5,7,\\ 4n+2 &{}\quad \text{ for }\;k=6,8,9,10,11,\\ 4n+3 &{}\quad \text{ for }\;k=12,13,14,16,17,18,\\ 4n+4 &{}\quad \text{ for }\;k=15,20,21,22,23,\\ 4n+5 &{}\quad \text{ for }\;k=19,\\ 4n+6+\nu _{5}(n+1) &{}\quad \text{ for }\;k=24 \end{array} \end{array}\right. } \end{aligned}$$

It is very likely that the method employed by Amdeberhan and Moll can be extended in order to confirm the above conjecture. However, it would be nice to have general method which works for all \(p\in {\mathbb {P}}\).

Let \(d\in \mathbb {N}_{\ge 2}\) be fixed and for \(n\in \mathbb {N}_{+}\) define the matrix

$$\begin{aligned} M_{d}(n,x)=[H_{d}(i+j,x)]_{0\le i, j\le n-1}. \end{aligned}$$

Based on numerical calculations we formulate the following

Conjecture 9.5

Let \(d\in \mathbb {N}_{\ge 2}\).

  1. (1)

    For \(n\in \mathbb {N}_{+}\) we have \({\text {det}}M_d(n,x)\in \mathbb {Z}\) and

    $$\begin{aligned} {\text {det}}M_d(n,x)\equiv 0\pmod {\prod _{i=0}^{n-1}i!}; \end{aligned}$$
  2. (2)

    For \(n\in \mathbb {N}_{+}\) we have the identity

    $$\begin{aligned} {\text {det}}M_{2}(n,x)=\prod _{i=0}^{n-1}i!\;. \end{aligned}$$
  3. (3)

    If \(d\ge 3\), then we have the following property

    $$\begin{aligned} {\text {det}}M_{d}(n,x)=0 \Leftrightarrow n\equiv 2,\ldots , d-1\pmod {d}. \end{aligned}$$

Let \(a,b\in \mathbb {N}_{\ge 2}\) with \(a<b\). It seems to be interesting to find out if there are some integers \(n\ge a\) and \(m\ge b\) such that

$$\begin{aligned} H_a(n)=H_b(m). \end{aligned}$$
(25)

We only know that if a is a prime number then the Eq. (25) has no solutions, as a divides the left hand side and does not divide the right hand side.

Question 9.6

Is there any quadruple \((a,b,n,m)\in \mathbb {N}^4\) such that \(2\le a<b\), \(n\ge a\), \(m\ge b\) and \(H_a(n)=H_b(m)\)? If yes, are there infinitely many such quadruples?