1 Introduction

Let \(q \ge3\) be a positive integer. For any positive integer k and integer m, the kth Gauss sums \(G(m, k; q)\) are defined as

$$G(m, k;q) = \sum_{a=1}^{q} e \biggl( \frac{ma^{k} }{q} \biggr), $$

where \(e(y) = e^{2\pi i y}\).

Concerning these sums, many authors had studied their properties and obtained a series of interesting results, see [1, 2]. In fact, from Weil’s important work [1], one can get the upper bound estimate

$$\Biggl\vert \sum_{a=1}^{p-1} \chi(a) e \biggl(\frac{ma^{k} }{p} \biggr)\Biggr\vert \ll_{k}\sqrt{p}, $$

where p is an odd prime, χ denotes a Dirichlet character modp and \(\ll_{k}\) denotes the Big O notation dependent on k.

We also mention that the fourth power mean value of \(G(m,k;q)\) was well explored by Zhang and Liu [2], in which some sharp asymptotic formulas can be found.

On the other hand, Yang and Tang [3] studied a number of solutions of the congruence equation

$$x^{2}+y^{2}\equiv c\operatorname{mod} n \quad\mbox{with } (xy, n)=1 $$

and gave an exact computational formula for it.

Let s be a positive integer and p be an odd prime with \(p\equiv 1\operatorname{mod}3\). Let \(M_{s}\) denote a number of solutions of the equation

$$X_{1}^{3}+X_{2}^{3}+ X_{3}^{3} +\cdots+ X_{s}^{3}= 0 $$

in the finite field \(GF(p)\), and let \(U_{s}=M_{s}-p^{s-1}\). Chowla et al. [4] proved that \(U_{s}\) satisfies the linear recurrence

$$U_{s}-3pU_{s-2}-pdU_{s-3}=0, $$

where \(U_{1}=0\), \(U_{2}=2p-2\) and \(U_{3}=(p-1)d\) with d being uniquely determined by \(4p=d^{2}+27b^{2}\) and \(d\equiv1\operatorname{mod}3\).

Some related results can also be found in [57].

Now we consider a similar problem: Let n be a positive integer and p be an odd prime with \(p\equiv1\operatorname{mod}4\). Let \(M_{n}(p)\) denote a number of solutions of the congruence equation

$$\begin{aligned} x_{1}^{4}+x_{2}^{4}+ \cdots+x_{n-1}^{4}+ x_{n}^{4}\equiv0 \operatorname{mod} p, \end{aligned}$$
(1)

where \(0\leq x_{i}\leq p-1\), \(i=1, 2, \ldots, n\).

It is natural to ask whether there exists an exact computational formula for \(M_{n}(p)\) when n is a positive integer and p is an odd prime?

As far as we know, it seems that no one has studied this problem yet, at least we have not seen any related result before. The problem is interesting because it can help us to understand more accurate information of the quartic Gauss sums.

In this paper, we shall use the method of trigonometric sums and the properties of Gauss sums to study this problem and give some interesting computational formulas. For the sake of convenience, first we let \(B(p)=\sum_{a=1}^{p-1} (\frac{a+\overline{a}}{p} ) \), denotes the solution of the equation \(ax\equiv 1\operatorname{mod} p\), and \((\frac{*}{p} )\) denotes the Legendre symbol modp. Then we have the following theorem.

Theorem 1

Let \(p=8k+5\) be a prime, \(U_{n}(p)=M_{n}(p)-p^{n-1}\). Then, for any positive integer \(n\geq5\), we have the fourth-order linear recurrence formula

$$\begin{aligned} U_{n}(p)=-2pU_{n-2}(p)+4pB(p)U_{n-3}(p) - \bigl(9p^{2}-pB^{2}(p) \bigr)U_{n-4}(p), \end{aligned}$$

where the first four terms are \(U_{1}(p)=0, U_{2}(p)=-(p-1), U_{3}(p)= 3(p-1)B(p)\) and \(U_{4}(p)=-7p(p-1)+(p-1)B^{2}(p)\).

Theorem 2

Let \(p=8k+1\) be a prime, \(U_{n}(p)=M_{n}(p)-p^{n-1}\). Then, for any positive integer \(n\geq5\), we have the fourth-order linear recurrence formula

$$\begin{aligned} U_{n}(p)=6pU_{n-2}(p)+4pB(p)U_{n-3}(p) - \bigl(p^{2}-pB^{2}(p) \bigr)U_{n-4}(p), \end{aligned}$$

where the first four terms are \(U_{1}(p)=0, U_{2}(p)=3(p-1), U_{3}(p)= 3(p-1)B(p)\) and \(U_{4}(p)=17p(p-1)+ (p-1)B^{2}(p)\).

From these theorems we may immediately deduce the following two corollaries.

Corollary 1

Let \(p=8k+5\) be an odd prime. Then we have

$$M_{4}(p)=p^{3}+ (p-1)B^{2}(p)-7p(p-1), \qquad M_{5}(p)= p^{4}-10p(p-1)B(p). $$

Corollary 2

Let \(p=8k+1\) be an odd prime. Then we have

$$M_{4}(p)=p^{3}+ (p-1)B^{2}(p)+17p(p-1), \qquad M_{5}(p)= p^{4}+30p(p-1)B(p). $$

Note the estimate for character sums

$$\bigl|B(p)\bigr|=\Biggl\vert \sum_{a=1}^{p-1} \biggl( \frac{a+\overline{a}}{p} \biggr)\Biggr\vert \leq 2\sqrt{p}, $$

from Corollary 1 and Corollary 2 we can also deduce the following corollary.

Corollary 3

Let p be an odd prime with \(p\equiv1\operatorname{mod}4\). Then we have the asymptotic formulas

$$M_{4}(p)=p^{3}+O (p^{2} )\quad \textit{and} \quad M_{5}(p)= p^{4}+O (p^{\frac{5}{2}} ). $$

Remark

Let p be an odd prime with \(p\equiv1\operatorname{mod}4\), it is clear that we have the identity (see Theorems 4-11 in [8])

$$p= \Biggl(\frac{1}{2}\sum_{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr) \Biggr)^{2}+ \Biggl(\frac{1}{2} \sum_{a=1}^{p-1} \biggl(\frac{a+r\overline {a}}{p} \biggr) \Biggr)^{2}=\alpha^{2}+\beta^{2}, $$

where r is a quadratic non-residue modp, that is to say, \((\frac{r}{p} )=-1\). The above identity implies that \(|B(p)|\) is a constant depending only on p and \(|B(p)|\leq 2\sqrt{p}\).

For prime \(p=4k+3\) and positive b with \(1\leq b\leq p-1\), we have the identity

$$A(b)=\sum_{a=0}^{p-1}e \biggl( \frac{ba^{4}}{p} \biggr)=i \biggl(\frac {b}{p} \biggr)\sqrt{p}, \quad i^{2}=-1. $$

It is very easy to prove that \(M_{2n-1}(p)=p^{2n-2}\) and

$$M_{2n}(p)= p^{2n-1}+(-1)^{n}p^{n-1}(p-1). $$

2 Several lemmas

In this section, we give some lemmas which are necessary in the proofs of our theorems. Hereinafter, we shall use some properties of the classical Gauss sums, all of them can be found in reference [9], so they will not be repeated here. First we have the following lemma.

Lemma 1

Let p be an odd prime with \(p\equiv1\operatorname{mod}4\), \((\frac{*}{p} )=\chi_{2}\) denotes the Legendre symbol modp. Then, for any integer b with \((b, p)=1\), we have the identities

$$\begin{aligned}& (\mathrm{I}) \quad A(b)=\sum_{a=0}^{p-1}e \biggl(\frac{ba^{4}}{p} \biggr)= \biggl(\frac {b}{p} \biggr)\sqrt{p}+ \sum _{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)e \biggl(\frac{ba^{2}}{p} \biggr); \\& (\mathrm{II})\quad A^{2}(b)= R(p)\cdot p + 2 \biggl( \frac{b}{p} \biggr)\sqrt{p} \Biggl(\sum_{a=1}^{p-1} \biggl(\frac {a}{p} \biggr)e \biggl(\frac{ba^{2}}{p} \biggr) \Biggr)+ \biggl(\frac{b}{p} \biggr)\sqrt{p}\sum_{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr), \end{aligned}$$

where \(R(p)= -1\), if \(p=8k+5\); and \(R(p)=3\), if \(p=8k+1\).

Proof

From the definition of the quadratic residue modp and the properties of the Legendre symbol, we have

$$\begin{aligned} A(b) =&\sum_{a=0}^{p-1}e \biggl( \frac{ba^{4}}{p} \biggr)=1+\sum_{a=1}^{p-1}e \biggl(\frac{ba^{4}}{p} \biggr) =1+ \sum_{a=1}^{p-1} \bigl(1+\chi_{2}(a) \bigr)e \biggl(\frac{ba^{2}}{p} \biggr) \\ =&\sum_{a=0}^{p-1}e \biggl( \frac{ba^{2}}{p} \biggr)+\sum_{a=1}^{p-1}\chi _{2}(a)e \biggl(\frac{ba^{2}}{p} \biggr). \end{aligned}$$
(2)

Since \(p\equiv1\operatorname{mod}4\), from [9] (see formula (29) of Section 9.10) we know that

$$\begin{aligned} \sum_{a=0}^{p-1}e \biggl( \frac{ba^{2}}{p} \biggr)= \biggl(\frac{b}{p} \biggr)\sum _{a=0}^{p-1}e \biggl(\frac{a^{2}}{p} \biggr)= \biggl( \frac{b}{p} \biggr)\sqrt{p}. \end{aligned}$$
(3)

From (2) and (3) we may immediately deduce formula (I) of Lemma 1.

Now we prove formula (II) of Lemma 1. It is clear that from (I) we have

$$\begin{aligned} A^{2}(b)= p+ 2 \biggl(\frac{b}{p} \biggr)\sqrt{p} \Biggl(\sum_{a=1}^{p-1} \biggl( \frac {a}{p} \biggr)e \biggl(\frac{ba^{2}}{p} \biggr) \Biggr)+ \Biggl(\sum _{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)e \biggl(\frac{ba^{2}}{p} \biggr) \Biggr)^{2}. \end{aligned}$$
(4)

From the properties of the reduced residue system modp and (3), we have

$$\begin{aligned} \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)e \biggl(\frac {ba^{2}}{p} \biggr) \Biggr)^{2} =&\sum_{x=1}^{p-1}\sum _{y=1}^{p-1} \biggl(\frac {xy}{p} \biggr)e \biggl(\frac{b(x^{2}+y^{2})}{p} \biggr) \\ =&\sum_{x=1}^{p-1} \biggl(\frac{x}{p} \biggr)\sum_{y=1}^{p-1}e \biggl( \frac {by^{2}(x^{2}+1)}{p} \biggr) \\ =&(p-1) \mathop{\sum_{x=1}^{p-1}}\limits_{x^{2}+1\equiv0\operatorname{mod}p} \biggl(\frac{x}{p} \biggr) \\ &{}+\mathop{\sum_{x=1}^{p-1}}\limits_{(x^{2}+1, p)=1} \biggl(\frac{x}{p} \biggr) \Biggl(\sum_{y=0}^{p-1}e \biggl(\frac {by^{2}(x^{2}+1)}{p} \biggr)-1 \Biggr) \\ =&p\mathop{\sum_{x=1}^{p-1}}\limits_{x^{2}+1\equiv0\operatorname{mod}p} \biggl(\frac{x}{p} \biggr)-\sum_{x=1}^{p-1} \biggl(\frac{x}{p} \biggr)+ \biggl(\frac{b}{p} \biggr)\sqrt{p}\sum _{x=1}^{p-1} \biggl(\frac {x(x^{2}+1)}{p} \biggr) \\ =&I(p)p+ \biggl(\frac{b}{p} \biggr)\sqrt{p}\sum _{a=1}^{p-1} \biggl(\frac {a+\overline{a}}{p} \biggr), \end{aligned}$$
(5)

where \(I(p)=-2\), if \(p=8k+5\); and \(I(p)=2\), if \(p=8k+1\).

Combining (4) and (5), we have the identity

$$\begin{aligned} A^{2}(b)= R(p)\cdot p + 2 \biggl(\frac{b}{p} \biggr)\sqrt{p} \Biggl(\sum_{a=1}^{p-1} \biggl( \frac {a}{p} \biggr)e \biggl(\frac{ba^{2}}{p} \biggr) \Biggr)+ \biggl( \frac{b}{p} \biggr)\sqrt{p}\sum_{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr). \end{aligned}$$

This proves formula (II) of Lemma 1.

Similarly, from (I) and (5) we can also prove that if \(p=8k+1\), then we have

$$\begin{aligned} A^{3}(b) = &7 \biggl(\frac{b}{p} \biggr) p^{\frac{3}{2}} + 5p \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)e \biggl(\frac {ba^{2}}{p} \biggr) \Biggr)+3p \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a+\overline {a}}{p} \biggr) \Biggr) \\ &{}+ \biggl(\frac{b}{p} \biggr)\sqrt{p} \Biggl(\sum _{a=1}^{p-1} \biggl(\frac {a}{p} \biggr)e \biggl( \frac{ba^{2}}{p} \biggr) \Biggr) \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr) \Biggr). \end{aligned}$$
(6)

If \(p=8k+5\), then we have

$$\begin{aligned} A^{3}(b) = &-5 \biggl(\frac{b}{p} \biggr) p^{\frac{3}{2}} + p \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)e \biggl(\frac {ba^{2}}{p} \biggr) \Biggr)+3p \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a+\overline {a}}{p} \biggr) \Biggr) \\ &{}+ \biggl(\frac{b}{p} \biggr)\sqrt{p} \Biggl(\sum _{a=1}^{p-1} \biggl(\frac {a}{p} \biggr)e \biggl( \frac{ba^{2}}{p} \biggr) \Biggr) \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr) \Biggr). \end{aligned}$$
(7)

 □

Lemma 2

Let p be an odd prime with \(p \equiv1\operatorname{mod}4\), \(A(p)\) is defined as in the above lemma, and let

$$N_{k}(p)=\sum_{b=1}^{p-1}A^{k}(b). $$

Then we have the identities

$$N_{1}(p)= 0,\qquad N_{2}(p)= R(p)p(p-1)\quad \textit{and}\quad N_{3}(p)= 3p(p-1) \Biggl( \sum_{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr) \Biggr), $$

where \(R(p)= -1\), if \(p=8k+5\); and \(R(p)=3\), if \(p=8k+1\).

Proof

Note the trigonometric identity

$$\begin{aligned} \sum_{m=0}^{p-1}e \biggl( \frac{nm}{p} \biggr)= \left \{ \textstyle\begin{array}{@{}l@{\quad}l} p, &\mbox{if }(p,n)=p; \\ 0, &\mbox{if }(p,n)=1, \end{array}\displaystyle \right . \end{aligned}$$
(8)

and

$$\sum_{b=1}^{p-1} \biggl( \frac{b}{p} \biggr)=0. $$

From Lemma 1 and the properties of Gauss sums we have

$$\begin{aligned}& \sum_{b=1}^{p-1}A(b)=\sum _{b=1}^{p-1} \Biggl(1+\sum _{a=1}^{p-1}e \biggl(\frac{ba^{4}}{p} \biggr) \Biggr)=p-1+\sum_{a=1}^{p-1}\sum _{b=1}^{p-1}e \biggl(\frac{ba^{4}}{p} \biggr)=0, \end{aligned}$$
(9)
$$\begin{aligned}& \begin{aligned}[b] \sum_{b=1}^{p-1}A^{2}(b)={}& \sum_{b=1}^{p-1} R(p)\cdot p + 2\sum _{b=1}^{p-1} \biggl(\frac{b}{p} \biggr)\sqrt{p} \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a}{p} \biggr)e \biggl(\frac{ba^{2}}{p} \biggr) \Biggr)\\ &{}+\sum_{b=1}^{p-1} \biggl(\frac{b}{p} \biggr)\sqrt{p}\sum_{a=1}^{p-1} \biggl( \frac{a+\overline{a}}{p} \biggr)\\ ={}&R(p)\cdot p(p-1)+2\sqrt{p}\sum_{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)\sum_{b=1}^{p-1} \biggl(\frac{b}{p} \biggr)e \biggl(\frac{ba^{2}}{p} \biggr)\\ ={}&R(p)\cdot p(p-1)+2p\sum_{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)^{3}=R(p)\cdot p(p-1). \end{aligned} \end{aligned}$$
(10)

Similarly, from (6) and (7) we have

$$\begin{aligned} \sum_{b=1}^{p-1}A^{3}(b)=3p(p-1) \Biggl(\sum_{a=1}^{p-1} \biggl( \frac {a+\overline{a}}{p} \biggr) \Biggr), \end{aligned}$$
(11)

where we have used the identity

$$\sum_{b=1}^{p-1} \Biggl(\sum _{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)e \biggl( \frac{ba^{2}}{p} \biggr) \Biggr)=\sum_{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)\sum_{b=1}^{p-1}e \biggl(\frac{ba^{2}}{p} \biggr)=-\sum_{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)=0. $$

Now Lemma 2 follows from (9), (10) and (11). □

Lemma 3

Let p be an odd prime with \(4|(p-1)\), then, for \(p=8k+5\), we have

$$\begin{aligned} A^{4}(b)=-2pA^{2}(b)+4pA(b) \Biggl(\sum _{a=1}^{p-1} \biggl(\frac{a+\overline {a}}{p} \biggr) \Biggr)-9p^{2}+p \Biggl(\sum_{a=1}^{p-1} \biggl(\frac {a+\overline{a}}{p} \biggr) \Biggr)^{2}. \end{aligned}$$

If \(p=8k+1\), then we have

$$\begin{aligned} A^{4}(b)=6pA^{2}(b)+4pA(b) \Biggl(\sum _{a=1}^{p-1} \biggl(\frac{a+\overline {a}}{p} \biggr) \Biggr)-p^{2}+p \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a+\overline {a}}{p} \biggr) \Biggr)^{2}. \end{aligned}$$

Proof

First, for any integer \(1\leq b\leq p-1\), from (5) and (II) of Lemma 1 we have

$$\begin{aligned} &A^{4}(b)-2R(p)pA^{2}(b) +R^{2}(p)p^{2} \\ &\quad= p \Biggl(2\sum_{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)e \biggl(\frac {ba^{2}}{p} \biggr)+\sum _{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr) \Biggr)^{2} \\ &\quad=4p \Biggl( \sum_{a=1}^{p-1} \biggl( \frac{a}{p} \biggr)e \biggl(\frac{ba^{2}}{p} \biggr) \Biggr)^{2}+ 4p \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a}{p} \biggr)e \biggl(\frac {ba^{2}}{p} \biggr) \Biggr) \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a+\overline {a}}{p} \biggr) \Biggr) \\ &\qquad{}+p \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a+\overline{a}}{p} \biggr) \Biggr)^{2} \\ &\quad=4p \Biggl(I(p)p+ \biggl(\frac{b}{p} \biggr)\sqrt{p}\sum _{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr) \Biggr)+ p \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a+\overline{a}}{p} \biggr) \Biggr)^{2} \\ &\qquad{}+4p \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a}{p} \biggr)e \biggl(\frac {ba^{2}}{p} \biggr) \Biggr) \Biggl(\sum _{a=1}^{p-1} \biggl(\frac{a+\overline {a}}{p} \biggr) \Biggr) \\ &\quad=4I(p)p^{2}+ 4p \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr) \Biggr) \Biggl( \biggl(\frac{b}{p} \biggr)\sqrt{p}+\sum_{a=1}^{p-1} \biggl( \frac {a}{p} \biggr)e \biggl(\frac{ba^{2}}{p} \biggr) \Biggr) \\ &\qquad{}+p \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a+\overline{a}}{p} \biggr) \Biggr)^{2} \\ &\quad=4I(p)p^{2}+ 4pA(b) \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr) \Biggr) +p \Biggl(\sum _{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr) \Biggr)^{2}. \end{aligned}$$
(12)

From (12), the definitions of \(R(p)\) and \(I(p)\) we know that if \(p=8k+5\), then

$$\begin{aligned} A^{4}(b)=-2pA^{2}(b)+4pA(b) \Biggl(\sum _{a=1}^{p-1} \biggl(\frac{a+\overline {a}}{p} \biggr) \Biggr)-9p^{2}+p \Biggl(\sum_{a=1}^{p-1} \biggl(\frac {a+\overline{a}}{p} \biggr) \Biggr)^{2}. \end{aligned}$$
(13)

If \(p=8k+1\), then we have

$$\begin{aligned} A^{4}(b)=6pA^{2}(b)+4pA(b) \Biggl(\sum _{a=1}^{p-1} \biggl(\frac{a+\overline {a}}{p} \biggr) \Biggr)-p^{2}+p \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a+\overline {a}}{p} \biggr) \Biggr)^{2}. \end{aligned}$$
(14)

Now Lemma 3 follows from (13) and (14). □

It is clear that our Lemma 3 obtained a fourth-order linear recurrence formula for the quartic Gauss sums \(A(b)\).

3 Proofs of the theorems

Now we shall complete the proofs of our main results. First we prove Theorem 1. If \(p=8k+5\) is an odd prime, then, for any positive integer n, from (8) and the definition of \(M_{n}(p)\) we have

$$\begin{aligned} M_{n}(p) =&\mathop{\sum_{x_{1}=0}^{p-1} \sum_{x_{2}=0}^{p-1}\cdots \sum _{x_{n}=0}^{p-1}}\limits_{x_{1}^{4}+x_{2}^{4}+\cdots+x_{n}^{4}\equiv0\operatorname{mod}p}1 =\frac{1}{p}\sum _{b=0}^{p-1} \Biggl(\sum _{x=0}^{p-1}e \biggl(\frac {bx^{4}}{p} \biggr) \Biggr)^{n} \\ =&p^{n-1}+\frac{1}{p}\sum_{b=1}^{p-1} \Biggl(\sum_{x=0}^{p-1}e \biggl( \frac{bx^{4}}{p} \biggr) \Biggr)^{n}=p^{n-1}+ \frac{1}{p}\sum_{b=1}^{p-1}A^{n}(b). \end{aligned}$$
(15)

So from (15) and Lemma 2 we have

$$\begin{aligned}& U_{1}(p)= M_{1}(p)-1=\frac{1}{p}\sum _{b=1}^{p-1}A(b)=0, \end{aligned}$$
(16)
$$\begin{aligned}& U_{2}(p)= M_{2}(p)-p=\frac{1}{p}\sum _{b=1}^{p-1}A^{2}(b)=-(p-1), \end{aligned}$$
(17)
$$\begin{aligned}& U_{3}(p)= M_{3}(p)-p^{2}= \frac{1}{p}\sum_{b=1}^{p-1}A^{3}(b)=3(p-1) \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a+\overline{a}}{p} \biggr) \Biggr). \end{aligned}$$
(18)

From Lemma 3 we have

$$\begin{aligned} U_{4}(p) =& M_{4}(p)-p^{3}= \frac{1}{p}\sum_{b=1}^{p-1}A^{4}(b) \\ =&-2pU_{2}(p)+4pU_{1}(p)B(p)-(p-1) \bigl(9p-B(p)^{2} \bigr) \\ =&-7p(p-1)+(p-1)B^{2}(p). \end{aligned}$$
(19)

If \(k\geq5\), then from (15) and Lemma 3 we have

$$\begin{aligned} U_{k}(p) =& M_{k}(p)-p^{k-1}= \frac{1}{p}\sum_{b=1}^{p-1}A^{k}(b)= \frac{1}{p}\sum_{b=1}^{p-1}A^{k-4}(b)A^{4}(b) \\ =&\frac{1}{p}\sum_{b=1}^{p-1}A^{k-4}(b) \Biggl( -2pA^{2}(b)+4pA(b) \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a+\overline {a}}{p} \biggr) \Biggr) \Biggr) \\ &{}- \Biggl(9p- \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a+\overline{a}}{p} \biggr) \Biggr)^{2} \Biggr)\sum _{b=1}^{p-1}A^{k-4}(b) \\ =&-2pU_{k-2}(p)+4p \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a+\overline {a}}{p} \biggr) \Biggr)U_{k-3}(p) \\ &{}- \Biggl(9p^{2}-p \Biggl(\sum_{a=1}^{p-1} \biggl(\frac{a+\overline {a}}{p} \biggr) \Biggr)^{2} \Biggr)U_{k-4}(p). \end{aligned}$$
(20)

Now Theorem 1 follows from formulas (16)-(20).

If \(p=8k+1\), then from (15) and Lemma 2 we have

$$\begin{aligned}& U_{1}(p)= M_{1}(p)-1=\frac{1}{p}\sum _{b=1}^{p-1}A(b)=0, \end{aligned}$$
(21)
$$\begin{aligned}& U_{2}(p)= M_{2}(p)-p=\frac{1}{p}\sum _{b=1}^{p-1}A^{2}(b)=3(p-1), \end{aligned}$$
(22)
$$\begin{aligned}& U_{3}(p)= M_{3}(p)-p^{2}= \frac{1}{p}\sum_{b=1}^{p-1}A^{3}(b)=3(p-1) \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a+\overline{a}}{p} \biggr) \Biggr). \end{aligned}$$
(23)

From Lemma 3 we also have

$$\begin{aligned} U_{4}(p) =& M_{4}(p)-p^{3}= \frac{1}{p}\sum_{b=1}^{p-1}A^{4}(b) \\ =&6pU_{2}(p)+4pU_{1}(p) \Biggl(\sum _{a=1}^{p-1} \biggl(\frac{a+\overline {a}}{p} \biggr) \Biggr)-(p-1) \Biggl(p- \Biggl(\sum_{a=1}^{p-1} \biggl(\frac {a+\overline{a}}{p} \biggr) \Biggr)^{2} \Biggr) \\ =&17p(p-1)+ (p-1)B^{2}(p). \end{aligned}$$
(24)

If \(k\geq5\), then from (15) and Lemma 3 we also have

$$\begin{aligned} U_{k}(p) =& M_{k}(p)-p^{k-1}= \frac{1}{p}\sum_{b=1}^{p-1}A^{k}(b)= \frac{1}{p}\sum_{b=1}^{p-1}A^{k-4}(b)A^{4}(b) =6pU_{k-2}(p) \\ &{}+4p \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a+\overline{a}}{p} \biggr) \Biggr)U_{k-3}(p)- \Biggl(p^{2}-p \Biggl(\sum_{a=1}^{p-1} \biggl( \frac{a+\overline {a}}{p} \biggr) \Biggr)^{2} \Biggr)U_{k-4}(p). \end{aligned}$$
(25)

Now Theorem 2 follows from formulas (21)-(25).