View metadata, citation and similar papers at core.ac.uk brought to you by CORE

provided by Elsevier - Publisher Connector

Journal of Number Theory 128 (2008) 475–499 www.elsevier.com/locate/jnt

On Wolstenholme’s theorem and its converse

Charles Helou a,∗, Guy Terjanian b

a Pennsylvania State University, 25 Yearsley Mill Road, Media, PA 19063, USA b Université Paul Sabatier, 118 route de Narbonne, 31062 Toulouse, France Received 3 May 2006; revised 6 June 2007 Available online 24 September 2007 Communicated by David Goss

Abstract     = 2n−1 = 1 2n  For any positive integer n,letwn n−1 2 n . Wolstenholme proved that if p is a prime 5, 3 then wp ≡ 1 (mod p ). The converse of Wolstenholme’s theorem, which has been conjectured to be true, remains an open problem. In this article, we establish several relations and congruences satisfied by the numbers wn, and we deduce that this converse holds for many infinite families of composite integers n. In passing, we obtain a number of congruences satisfied by certain classes of binomial coefficients, and involving the Bernoulli numbers. © 2007 Elsevier Inc. All rights reserved.

MSC: 11A07; 11A41; 11B65; 11B68

1. Introduction

Wolstenholme’s theorem  [W,HW,D,Gr] asserts that if p is a  5, then the bino- = 2p−1 ≡ 3 mial coefficient wp p−1 satisfies the congruence wp 1 (mod p ). It has been conjectured [Gr,Gu,M,Ri] that the converse is true, so that this congruence characterizes prime numbers. In = 2n−1 ≡ 3 other words, if wn n−1 , then wn 1 (mod n ) for composite numbers n. R.J. McIntosh [M] 9 4 verified that this holds for all composite n<10 .Hecalledaprimep satisfying wp ≡ 1 (mod p ) a Wolstenholme prime, showed that this is equivalent to the condition that p divides the numera- 8 tor of the Bp−3, found that there are only two Wolstenholme primes < 2×10 , and conjectured that there are infinitely many such primes, but that none satisfies the congruence

* Corresponding author. E-mail address: [email protected] (C. Helou).

0022-314X/$ – see front matter © 2007 Elsevier Inc. All rights reserved. doi:10.1016/j.jnt.2007.06.008 476 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499

5 8 9 wp ≡ 1 (mod p ). More recently, the limit 2 × 10 has been extended to 10 in [MR], where it is reported that the only Wolstenholme primes < 109 are 16843 and 2124679. On the other hand, A. Granville [Gr] established broader generalizations of Wolstenholme’s theorem, as well as many other important congruences involving binomial coefficients. In this article, we show that the converse of Wolstenholme’s theorem holds for several infi- nite classes of composite positive integers n. We also explore the arithmetical properties of the numbers wn, and establish some relations and congruences satisfied by them. Thus,   1 6   3 3 3 5 5 5 6+vp(n)+vp(wn) w ≡ w 1 − n p B 3− 2− + n p B − − n p B − mod p , np n p p 2 3 p 3 5 p 5 for all positive integers n and primes p  5, where vp is the p-adic valuation. And for p = 3, we have    2 3 4 3 2 6+v3(n)+v3(wn) w3n ≡ wn 1 + 3 n − 2 · 3 n (n − 1) (2n + 1) mod 3 .

We also get a more complicated expression for p = 2. However, reducing the modulus al- 4+v (n)+v (w ) lows for simpler congruences, namely wnp ≡ (1 + c(n,p)) · wn (mod p p p n ) where =−2 3 3  = 3 = 3 − 4 c(n,p) 3 p n Bp−3 if p 5 and c(n,3) 9n , while c(n,2) 4n 2n . In particular, 3 3 wnp ≡ wn (mod p ), for all primes p  5 and all n  1. It follows that wn ≡ 1 (mod n ) for every of the form n = mp h, where m, h are positive integers and p aprime 5 such  3 −  p+1   − that m 2 and p (wm 1), as well as for all primes p 3 and all integers 2 m p 1. Furthermore, if n is a multiple of 3 and n is not a sum of an odd number of distinct powers of 3, 3 or if n is an even integer  4, then wn ≡ 1 (mod n). In addition, wn ≡ 1 (mod n ) when n is a power of 3. ≡ 6  On the other hand, wp2 wp (mod p ) for all primes p 5. Moreover,     3 5 1 6 6 w ≡ 1 − p B 3− 2− + p B − − B − mod p , p p p 2 3 p 3 5 p 5 for all primes p  5. Further congruences, involving lower order Bernoulli numbers but longer ≡ 4 ≡ expressions, are also given in the text. It follows that wp2 1 (mod p ) if and only if Bp−3 0  ≡ 5 ≡ (mod p).Also,forp 7, we have wp2 1 (mod p ) if and only if Bp−3 0 (mod p) and ≡ 8 2 ≡ 6 B2p−4 3 Bp−3 (mod p ). Moreover, the congruence wp2 1 (mod p ) is equivalent to the con- − 3 + 2 − junction of the previous two congruences and the following one 2Bp−3 2 B2p−4 5 B3p−5 2 + 6 2 ≡ 3 15 pBp−3 5 p Bp−5 0 (mod p ). We start by establishing some congruences for certain types of products which arise naturally in the context of the present study. We then apply them to obtain congruences for specific classes of binomial coefficients, from which we derive the desired ones for the numbers wn.

2. Congruences for products

The set of natural numbers is denoted by N, the ring of rational integers by Z, and the field of rational numbers by Q. For a prime number p, the ring obtained by localization of Z at p is denoted by Z(p), and the p-adic valuation on Q by vp. The congruences considered in what follows generally hold in Z(p). C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499 477

We here establish some congruences for certain types of products needed in the sequel. Given a ∈ Z and m ∈ N \{0}, and a prime number p,weset

− p−1  m1  ap A (a, p) = 1 + , m jp + i j=0 i=1 also written Am when there is no risk of confusion.

Lemma 1. Let p be an odd prime number, a ∈ Z, and m a positive integer. Then

m(p−1)/2 min(k,m)   = + 2k Am(a, p) 1 p Sk1 (j1)...Skr (jr ), k=1 r=1 0j1<···

r where the last summation is over all r-tuples (k1,...,kr ) in N satisfying k1 +···+kr = k, and

 a(a + 2j + 1) Sn(j) = ei (j)...ei (j), with ei(j) = , 1 n j(j + 1)p2 + i(p − i)  ···  p−1 1 i1<

∈ N   p−1 for all i, j, n such that 1 i, n 2 .  ∈ N = p−1 + ap Proof. For any j ,letQj i=1 (1 jp+i ). Then

(p−1)/2  (p−1)/2  (p−1)/2  ap  ap    Q = 1 + · 1 + = 1 + e (j)p2 . j jp + i jp + p − i i i=1 i=1 i=1

  p−1 Since the Sn(j)’s (for 1 n 2 ) are the elementary symmetric functions of the ei(j)’s (for − − 1  i  p 1 ), upon expanding the latter product, we get Q = 1+ (p 1)/2 p2nS (j). Therefore  2  j n=1 n = m−1 = m−1 + (p−1)/2 2n Am j=0 Qj j=0 (1 n=1 p Sn(j)), for which a direct expansion yields

m−1 m−1  2 4 Am = 1 + p S1(j) + p S2(j) + S1(j1)S1(j2) +··· j=0 j=0 0j1

2k   m(p−1) Thus, Am is equal to 1 plus a sum of terms of the type p Ck,for1 k 2 , with

k   = Ck Sk1 (j1)...Skr (jr ), r=1 0j1<···m, the sum over j1,...,jr is empty, equal to zero, so that the outer summation is in fact for 1  r  min(k, m). Hence the announced formula. 2

Corollary. We have

m−1 m−1  2 4 Am(a, p) ≡ 1 + p S1(j) + p S2(j) + S1(j1)S1(j2) j=0 j=0 0j1

Proof. This results directly from Lemma 1, since, in the localization Z(p) of Z at p, each − ≡ vp(a)   p 1 ∈ N ≡ term ei(j) 0 (mod p ) (for 1 i 2 and j ), and therefore every sum Sn(j) 0 − nvp(a)   p 1 2 (mod p ) (for 1 n 2 ).

Lemma 2. For any odd prime p, and any a ∈ Z and m ∈ N \{0}, we have

1   A ≡ 1 + am(a + m)p2T − am m2 − 1 (2a + 3m)p4T m 1 6 2 1   + a2m 4m2 + 6am + 3a2 − 1 p4T 3 1,1     1 + + a2m(m − 1) 3m2 + (6a − 1)m + 3a2 − 1 p4T 2 mod p6 vp(a) , 6 1 where

p−1 2  = 1 ∈ N = 1 Tn n n (for n ) and T1,1 . i (p − i) i1(p − i1)i2(p − i2) i=1   p−1 1 i1

− + Proof. We apply the previous corollary, after determining m 1 S (j) modulo p4 vp(a), and j=0 1 − + both m 1 S (j) and S (j )S (j ) modulo p2 vp(a). j=0 2 0j1

p−1 p−1 2 2 1 S (j) = ei(j) = a(a + 2j + 1) and 1 j(j + 1)p2 + i(p − i) i=1 i=1 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499 479   1 1 1 1 j(j + 1) = ≡ 1 − p2 j(j + 1)p2 + i(p − i) i(p − i) + j(j+1) 2 i(p − i) i(p − i) 1 i(p−i) p   p − 1 mod p4 for 1  i  , 2 so that

p−1   2 1 j(j + 1) S (j) ≡ a(a + 2j + 1) 1 − p2 1 i(p − i) i(p − i) i=1   2 4+vp(a) ≡ a(a + 2j + 1)T1 − a(a + 2j + 1)j (j + 1)p T2 mod p .

Hence

m−1 m−1 m−1   2 4+vp(a) S1(j) ≡ aT1 (a + 2j + 1) − ap T2 (a + 2j + 1)j (j + 1) mod p . j=0 j=0 j=0

m−1 n   Moreover, using the classical formulas for the power sums j=0 j for 1 n 3 [IR], we get

m−1 (a + 2j + 1) = (a + 1)m + m(m − 1) = m(a + m) and j=0 − m1 m(m − 1) m(m − 1)(2m − 1) m2(m − 1)2 (a + 2j + 1)j (j + 1) = (a + 1) + (a + 3) + 2 2 6 4 j=0 m(m2 − 1)(2a + 3m) = . 6 Therefore

m−1     1 + S (j) ≡ am(a + m)T − am m2 − 1 (2a + 3m)p2T mod p4 vp(a) . 1 1 6 2 j=0

∈ N = − Similarly, for every j ,wehaveS2(j)   p 1 ei1 (j)ei2 (j),i.e. 1 i1

1 ≡ 1 2 2 (j (j + 1)p + i1(p − i1))(j (j + 1)p + i2(p − i2)) i1(p − i1)i2(p − i2)   p − 1 mod p2 for 1  i

Hence

m−1 m−1   2 2 2 2+2vp(a) S2(j) ≡ a T1,1 (a + 1) + 4(a + 1)j + 4j mod p . j=0 j=0

Moreover,

− m1  2 (a + 1)2 + 4(a + 1)j + 4j 2 = (a + 1)2m + 2(a + 1)m(m − 1) + m(m − 1)(2m − 1) 3 j=0 m(4m2 + 6am + 3a2 − 1) = . 3

Therefore

m−1     1 + S (j) ≡ a2m 4m2 + 6am + 3a2 − 1 T mod p2 2vp(a) . 2 3 1,1 j=0

2+v (a) Similarly, for j ∈ N, in view of what precedes, S1(j) ≡ a(a + 2j + 1)T1 (mod p p ). Hence     + ≡ 2 2 + + + + 2 vp(a) S1(j1)S1(j2) a T1 (a 2j1 1)(a 2j2 1) mod p . 0j1

Moreover, using the formulas for the power sums repeatedly, we get  (a + 2j1 + 1)(a + 2j2 + 1) 0j1

Therefore  1   S (j )S (j ) ≡ a2m(m − 1) 3m2 + (6a − 1)m + 3a2 − 1 T 2 1 1 1 2 6 1 0j1

Substituting the expressions obtained above into the congruence of the Corollary yields the desired result. 2

Lemma 3. Let p beaprime 7. Let

p−1 2  = 1 ∈ N = 1 Tn n n (for n ) and T1,1 . i (p − i) i1(p − i1)i2(p − i2) i=1   p−1 1 i1

≡−p + p3 − p3 4 (1) T1 2 Bp3−p2−2 6 Bp−3 5 Bp−5 (mod p ), ≡ 2p 2 (2) T2 5 Bp−5 (mod p ), ≡−p 2 (3) T1,1 5 Bp−5 (mod p ), where the Bk’s are the Bernoulli numbers (k ∈ N).

∈ N = p−1 1 = p−1 n Proof. For n ,letRn i=1 in and Pn i=1 i . First,

p−1   p−1 2 1 1 1 1  1 1 T = + = = R . 1 p i p − i p i p 1 i=1 i=1 Then

p−1 p−1     p−1 2 1 1 1 2 1 2 1 1 2 1  1 T = + = + + = + 2T , 2 p2 i p − i p2 i2 (p − i)2 i(p − i) p2 i2 1 i=1 i=1 i=1 i.e. T = 1 R + 2 R . 2 p2 2 p3 1 Now,     1 1 1 1 1 T = + + , 1,1 2 p i1 p − i1 i2 p − i2   p−1 1 i1

Setting j1 = p − i1 and j2 = p − i2, the latter sum splits as the sum of the following four sums:

 1  1 and , i1i2 i1j2   p−1  p−1 − 1 i1

1   − Added up, these four sums make up the sum of all terms of the type ij for 1 i

p−1 1  1 2 1 T = − . 1,1 p2 ij i(p − i) 1i

Moreover,

p−1 2 p−1  1 1  1  1 = − . ij 2 i i2 1i

So, in view of what precedes,       1 1 2 1 2 1 T , = R − R − T = R − R − R . 1 1 p2 2 1 2 1 2p2 1 2 p3 1

By the Fermat–Euler theorem [HW], for 1  i  p − 1, and h, n ∈ N, with h  1, we 1 ≡ ϕ(ph)−n h h = h−1 − have in i (mod p ), where ϕ(p ) p (p 1) is Euler’s totient function. So ≡ h  h Rn Pϕ(ph)−n (mod p ), provided that n ϕ(p ). By a classic formula for the power sums in terms of the Bernoulli numbers [IR] or [HW],     m+1 + m+1 1 m 1 r 1 m r P = p B + − = p B + − , m m + 1 r m 1 r r r − 1 m 1 r r=1 r=1 for any positive integer m. Moreover, vp(Bk)  −1 for any k ∈ N, and vp(Bk)  0if(p − 1) k [IR]. So       1 m r m v p B + − = r − v (r) + v + v (B + − )  r − v (r) − 1. p r r − 1 m 1 r p p r − 1 p m 1 r p

It follows that      1 m r h P ≡ p B + − mod p , m r r − 1 m 1 r r−vp(r)h where the summation is over all integers 1  r  m + 1 such that r − vp(r)  h. C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499 483

≡ 5 = 5 − = 4 − − In particular, R1 Pϕ(p5)−1 (mod p ), and taking m ϕ(p ) 1 p (p 1) 1, we have      1 m r 5 P ≡ p B + − mod p . m r r − 1 m 1 r r−vp(r)5

s For 1  r  m + 1, let s = vp(r) and r = p u, with s,u ∈ N and p u. Then r − vp(r)  5if and only iff psu  s + 5, which implies that ps  s + 5. But ps >s+ 5fors  1 (by induction on s). So r − vp(r)  5 if and only if 1  r  5. Moreover, since Bk = 0 for all odd k  3, and 4 m + 1 = p (p − 1) is even and much larger than 3, then Bm+1−r = 0forr = 1, 3, 5. Therefore   1 5 4 2 R ≡ p − p − 1 p B 5− 4− 1 2 p p 2 5 − 4 − 5 − 4 − 5 − 4 −   1 (p p 1)(p p 2)(p p 3) 4 5 + p B 5− 4− mod p , 4 6 p p 4 that is

2 4   p p 5 R ≡− B 5− 4− − B 5− 4− mod p . 1 2 p p 2 4 p p 4

Furthermore, by the Kummer congruences [IR], since (p −1) (p5 −p4 −2), and p5 −p4 −2 ≡ p3 − p2 − 2 (mod ϕ(p3)), then   5 − 4 − 2   p p 2 2 p 3 B 5− 4− ≡ B 3− 2− ≡ B 3− 2− ≡ 1 − B 3− 2− mod p . p p 2 p3 − p2 − 2 p p 2 p2 + 2 p p 2 2 p p 2

Hence

2 4 4   p p p 5 R ≡− B 3− 2− + B 3− 2− − B 5− 4− mod p . 1 2 p p 2 4 p p 2 4 p p 4 But, we similarly have

p3 − p2 − 2 2 B 3− 2− ≡ B − ≡ B − (mod p) and p p 2 p − 3 p 3 3 p 3 p5 − p4 − 4 4 B 5− 4− ≡ B − ≡ B − (mod p). p p 4 p − 5 p 5 5 p 5

Hence

2 4 4   p p p 5 R ≡− B 3− 2− + B − − B − mod p , 1 2 p p 2 6 p 3 5 p 5 so that

3 3   1 p p p 4 T = R ≡− B 3− 2− + B − − B − mod p . 1 p 1 2 p p 2 6 p 3 5 p 5 484 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499

≡ 4 = 4 − = 4 − 3 − Similarly, R2 Pϕ(p4)−2 (mod p ), and setting m ϕ(p ) 2 p p 2, we have      1 m r 4 P ≡ p B + − mod p . m r r − 1 m 1 r r−vp(r)4

Also, the condition r − vp(r)  4, with 1  r  m + 1, amounts to 1  r  4. Moreover, since 3 m + 1 = p (p − 1) − 1 is odd, Bm+1−r = 0forr even

4 − 3 − 4 − 3 −   1 (p p 2)(p p 3) 3 4 P ≡ pB 4− 3− + p B 4− 3− mod p , i.e. m p p 2 3 2 p p 4   ≡ ≡ + 3 4 R2 Pm pBp4−p3−2 p Bp4−p3−4 mod p .

Also, by the Kummer congruences,   4 − 3 − 2   p p 2 p 3 B 4− 3− ≡ B 3− 2− ≡ 1 − B 3− 2− mod p and p p 2 p3 − p2 − 2 p p 2 2 p p 2 2 4 B 3− 2− ≡ B − (mod p), and B 4− 3− ≡ B − (mod p). p p 2 3 p 3 p p 4 5 p 5 Hence

3   p 4 3 4 R ≡ pB 3− 2− − B − + p B − mod p . 2 p p 2 3 p 3 5 p 5 It follows that   3 2 4 5 p T = pR + 2R ≡ p B − mod p and 2 2 1 5 p 5   4   3 p 2 p p 5 p T = R − R − R ≡− R − R ≡− B − mod p . 1,1 2 1 2 1 2 2 1 5 p 5

≡ 2p 2 ≡−p 2 2 Therefore T2 5 Bp−5 (mod p ) and T1,1 5 Bp−5 (mod p ).  ∈ Z ∈ N \{ } = Proposition  1. Let p be a prime number 7, a , m 0 , and let Am(a, p) m−1 p−1 + ap j=0 i=1 (1 jp+i ). Then

1 3 1 5 A (a, p) ≡ 1 − am(a + m)p B 3− 2− + am(a + m)p B − m 2 p p 2 6 p 3     1 2 2 5 6+v (a) − am(a + m) a + am + m p B − mod p p . 5 p 5

Proof. This is obtained by substitution of the expressions for T1, T2 and T1,1 from Lemma 3 into the expression for Am = Am(a, p) from Lemma 2. Note first that T1 ≡ 0 (mod p), so that the + 4 2 2 ≡ 6 vp(a) last term in Am, containing the factors p T1 and a ,is 0 (mod p ) and can be dropped. Thus C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499 485   3 3 2 p p p A ≡ 1 + am(a + m)p − B 3− 2− + B − − B − m 2 p p 2 6 p 3 5 p 5     1 2 5 1 2 2 2 5 − am m − 1 (2a + 3m)p B − − a m 4m + 6am + 3a − 1 p B − 15 p 5 15 p 5

1 3 1 5 ≡ 1 − am(a + m)p B 3− 2− + am(a + m)p B − 2 p p 2 6 p 3      1 2 2 2 5 − am 3(a + m) + m − 1 (2a + 3m) + a 4m + 6am + 3a − 1 p B − 15 p 5

1 3 1 5 ≡ 1 − am(a + m)p B 3− 2− + am(a + m)p B − 2 p p 2 6 p 3     1 2 2 5 6+v (a) − am(a + m) a + am + m p B − mod p p . 2 5 p 5

Lemma 4. For the primes p = 5 and p = 3, keeping the above notation Am(a, p), for any a ∈ Z and m ∈ N \{0}, we have

3 + ≡ + 5 + − 4 + 2 + + 2 − 6 v5(a) (1) Am(a, 5) 1 12 am(a m) 5 am(a m)(a am m 1)(mod 5 ), 2 + ≡ + 3 + − 4 + − − + + 6 v3(a) (2) Am(a, 3) 1 2 am(a m) 3 am(a m)(a 1)(m 1)(a m 1)(mod 3 ).

Proof. We substitute into the expression of Am(a, p) from Lemma 2 the actual values of T1, T2 and T1,1, which are easily calculated for p = 5 and p = 3. = = 5 = 13 = 1 (1) For p 5, we have T1 12 , T2 144 and T1,1 24 .So

53 13   A (a, 5) ≡ 1 + am(a + m) − · 54am m2 − 1 (2a + 3m) m 12 864 4    5 + + a2m 4m2 + 6am + 3a2 − 1 mod 56 v5(a) , 72 i.e.

53 A (a, 5) ≡ 1 + am(a + m) m 12   4       5 13 + + am a 4m2 + 6am + 3a2 − 1 − m2 − 1 (2a + 3m) mod 56 v5(a) . 72 12

54 2 The last factor, that of 72 am, evaluated modulo 5 , can be replaced by

    a 4m2 + 6am + 3a2 − 1 + m2 − 1 (2a + 3m)     = 3 a3 + m3 + 2am(a + m) − (a + m) = 3(a + m) a2 + am + m2 − 1 . 486 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499

Therefore

3 4    5 5 + A (a, 5) ≡ 1 + am(a + m) + am(a + m) a2 + am + m2 − 1 mod 56 v5(a) , m 12 24 which is the desired expression, since 24 is −1 (mod 52). = = 1 = 1 = (2) For p 3, we have T1 2 , T2 4 and T1,1 0. So

32 33    A (a, 3) ≡ 1 + am(a + m) + am(m − 1) a 3m2 + (6a − 1)m + 3a2 − 1 m 2 8   + − (m + 1)(2a + 3m) mod 36 v3(a) .

33 − An expansion of the factor of 8 am(m 1) in this expression yields as a replacement     3 (a − 1)m2 + 2a2 − a − 1 m + a3 − a   = 3(a − 1) m2 + (2a + 1)m + a2 + a = 3(a − 1)(a + m)(a + m + 1).

Therefore

2 4   3 3 + A (a, 3) ≡ 1 + am(a + m) + am(m − 1)(a − 1)(a + m)(a + m + 1) mod 36 v3(a) , m 2 8 which is the desired expression, since 8 is −1 (mod 32). 2

Remark 1. The congruence in Proposition 1 is also valid for p = 5, i.e.   3 5 5   p p p 2 2 A (a, p) ≡ 1 − am(a + m) B 3− 2− − B − + a + am + m B − m 2 p p 2 6 p 3 5 p 5   + mod p6 vp(a) , for any prime p  5. Indeed, for p = 5, the right-hand side term in this congruence is   1 52   R = 1 − 53am(a + m) B − B + 5 a2 + am + m2 B . 2 98 6 2 0

= = 1 ≡ 3 Since B0 1 and B2 6 , while B98 19 (mod 5 ), by the PARI-GP calculator, then

1 52   B − B + 5 a2 + am + m2 B 2 98 6 2 0   31   1   ≡ 5 a2 + am + m2 − ≡ 5 a2 + am + m2 − 1 − mod 53 , 2 12 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499 487 so that       1 + R ≡ 1 + 53am(a + m) − 5 a2 + am + m2 − 1 mod p6 vp(a) , 12 which is precisely the expression of Am(a, 5) in Lemma 4. Furthermore, on the basis of numerical evidence, we conjecture that the congruence in Propo- + + + + + sition 1 holds, not only modulo p6 vp(a), but also modulo p6 vp(a) vp(m) vp(a m),forp  5.

Remark 2. In the case of the prime p = 2, a similar approach allows to obtain an expression − + = m 1 + 2a 6 v2(a) = + m k k for Am(a, 2) j=0 (1 2j+1 ) modulo 2 . Indeed, Am(a, 2) 1 k=1 2 a Sk, where the S ’s (for 1  k  m) are the elementary symmetric functions of the terms 1 (for 0  j  k 2j+1 + − ≡ + 5 k k 6 v2(a) = m 1). Then Am(a, 2) 1 k=1 2 a Sk (mod 2 ) (with the convention that Sk 0if 6−k   k>m), and the sums Sk are to be determined modulo 2 (for 1 k 5). This is done by 1 5 − n n n replacing each 2j+1 by n=0( 1) 2 j , expanding, and evaluating the resulting expressions modulo 26, as was done in the case of odd primes. The resulting congruence, more complicated than for odd primes, is     am(m3 − 1) m A (a, 2) ≡ 1 − 2 · 5am2 + 22 · 5a − m4 − 23a3m2 m 2 3         2 3   m m (m − 1) m + + 24a2 a2 + + 25a a + m mod 26 v2(a) , 4 2 5   m = with the convention that the binomial coefficient k 0ifk>m.

Remark 3. Reducing the moduli in the previous results, we get the following simpler congru- ences, for all a ∈ Z and m ∈ N \{0}:

+  ≡ − 1 + 3 4 vp(a) (1) For any prime p 5, we have Am(a, p) 1 3 am(a m)p Bp−3 (mod p ). 2 + = ≡ + 3 + 4 v3(a) (2) For p 3, we have Am(a, 3) 1 2 am(a m) (mod 3 ). 4+v (a) (3) For p = 2, we have Am(a, 2) ≡ 1 + 2am(a + m − am) (mod 2 2 ).

Indeed, the first congruence follows from Proposition 1 and Remark 1, taking into account the ≡ 2 Kummer congruence (encountered in the proof of Lemma 3) Bp3−p2−2 3 Bp−3 (mod p),for p  5. The second one is an immediate consequence of Lemma 4. The third congruence can be verified by induction on m. Indeed, it holds trivially for m = 1, and assuming that it does for m, we check that it holds for m + 1 too, as follows:   2a A + (a, 2) = A (a, 2) · 1 + m 1 m 2m + 1      ≡ 1 + 2am(a + m − am) · 1 + 2a 1 − 2m + 4m2    ≡ 1 + 2am(a + m − am) + 2a + 4am − 8am2 a(a + m − am) − 1   ≡ 1 + 2am(a + m − am) + 2a + 4a(a − 1)m − 8a a2 − 1 m2 488 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499

≡ 1 + 2am(a + m − am) + 2a − 4a(a − 1)m    + ≡ 1 + 2a(m + 1) a + m + 1 − a(m + 1) mod 24 v2(a) .

3. Congruences for binomial coefficients

Lemma 5. Let m, n ∈ N such that 1  m  n, and let p be a prime number. Then

    − p−1  np n m1  (n − m)p = · 1 + . mp m jp + i j=0 i=1   np Proof. Starting from the definition of the binomial coefficient mp as the quotient of two prod- ucts of consecutive integers, and collecting together, in each of the products, the factors that are divisible by p and those that are not, we get       mp n n−1 p−1 np ((n − m)p + r) = − + (kp) · = − = (kp + i) = r=1 = k n m 1  k nm i 1 . mp (mp)! m · m−1 p−1 + j=1(jp) j=0 i=1 (jp i)

Clearly,

n n m m (kp) = k · pm and (jp) = j · pm, k=n−m+1 k=n−m+1 j=1 j=1 so that   n n   = − + (kp) = − + k n kn m 1 = k n m 1 = . m ! j=1(jp) m m

Moreover, setting k = n − m + j in the double product appearing in the numerator of the expres- np sion of mp , we get

n−1 p−1 m−1 p−1  (kp + i) = (n − m)p + jp + i . k=n−m i=1 j=0 i=1   np Substituting these expressions into that of mp , and writing the quotient of the two double prod- ucts as the double product of the quotients, we obtain

    − p−1   − p−1  np n m1  (n − m)p + jp + i n m1  (n − m)p = · = · 1 + . 2 mp m jp + i m jp + i j=0 i=1 j=0 i=1

Proposition 2. Let p be a prime number, and m, n ∈ N such that 0  m  n. C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499 489

(1) If p  5, then       np n p3 p5 ≡ · 1 − mn(n − m) B 3− 2− − B − mp m 2 p p 2 6 p 3      1 2 2 5 6+v (n−m)+v ( n ) + m − mn + n p B − mod p p p (m) . 5 p 5

(2) If p = 3, then        3n n 32 ≡ · 1 + mn(n − m) − 34(m − 1)(n + 1)(n − m − 1) 3m m 2   6+v (n−m)+v ( n ) mod 3 3 3 (m) .

Proof. First note that the congruences hold trivially in the case m = 0, since the two sides re- duce to 1. So we assume 1  m  n. In view of Lemma 5, np = n · A (n − m, p), where   mp m m = m−1 p−1 + ap ∈ Z Am(a, p) j=0 i=1 (1 jp+i ) for a . Then, by Proposition 1 and Remark 1, for p  5, with a = n − m,wehave,     1 3 1 5 1 2 2 5 A (n − m, p) ≡ 1 − mn(n − m) p B 3− 2− − p B − + m − mn + n p B − m 2 p p 2 6 p 3 5 p 5   + − mod p6 vp(n m) .

Similarly, by Lemma 4, for p = 3, we have   2   3 + − A (n − m, 3) ≡ 1 + mn(n − m) − 34(m − 1)(n + 1)(n − m − 1) mod 36 v3(n m) . m 2     np n Substituting these expressions into the formula relating mp and m yields the desired con- gruences. 2

Remark 4. For p = 5, we also have the simpler alternative congruence, based on Lemma 4, namely        5n n 53   ≡ · 1 + mn(n − m) − 54 m2 − mn + n2 − 1 5m m 12   6+v (n−m)+v ( n ) mod 5 5 5 (m) .

Furthermore, using the reduced moduli and the results in Remark 3, we similarly obtain

(1) For p  5,        np n 1 3 4+v (n−m)+v ( n ) ≡ 1 − mn(n − m)p B − mod p p p (m) . mp m 3 p 3 490 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499

(2) For p = 3,      2   3n n 3 4+v (n−m)+v ( n ) ≡ 1 + mn(n − m) mod 3 3 3 (m) . 3m m 2

(3) For p = 2,          2n n 2 4+v (n−m)+v ( n ) ≡ 1 + 2m(n − m) m − mn + n mod 2 2 2 (m) . 2m m     n = n − Remark 5. Since m n−m , then, exchanging m and n m, we see that the above congruences h+v (m)+v ( n ) h+max(v (m),v (n−m))+v ( n ) are also valid modulo p p p (m) , therefore modulo p p p p (m) , with h = 6 or 4, according to the context. In fact, as in Remark 1, we conjecture that these congruences h+v (m)+v (n−m)+v (n)+v ( n ) are valid modulo p p p p p (m) .

Corollary. Let m, n ∈ N be such that 0  m  n.

(1) For any prime p  5,       np n 3+max(v (m),v (n−m))+v ( n ) ≡ mod p p p p (m) . mp m

(2) For p = 3,       3n n 2+max(v (m),v (n−m))+v ( n ) ≡ mod 3 3 3 3 (m) . 3m m

(3) For p = 2,       2n n 1+max(v (m),v (n−m))+v ( n ) ≡ mod 2 2 2 2 (m) . 2m m     2n ≡ n 2 In particular, 2m m (mod 2 ).

Here, the last congruence follows from the previous one, since if v2(m) = v2(n − m) = 0, n  then m is odd and n is even, and therefore v2 m 1.

Remark 6. Using p-adic methods, the modulus in the previous Corollary can be improved 3+v (m)+v (n)+v (n−m)+v ( n ) 2+v (m)+v (n)+v (n−m)+v ( n ) to p p p p p (m) for p  5, and to 3 3 3 3 3 (m) for p = 3 ([Ro], the Kazandzidis congruences).   But here, following a more elementary method, we derived np n congruences relating mp and m to a modulus for which they are not necessarily in the same congruence class, namely modulo p6+··· instead of p3+···. C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499 491

4. Wolstenholme’s theorem and generalizations

 −  The binomial coefficients related to Wolstenholme’s theorem are of the form w = 2n 1 =    n  n−1  1 2n = mn−1 = 1 mn 2 n . We start by considering a slightly broader class consisting of wm,n n−1 m n , for any positive integers m, n, so that wn = w2,n. They satisfy some congruences that generalize Wolstenholme’s theorem.

Proposition 3. Let p be a prime number, and m, n be positive integers.

(1) If p  5, then    3 5   3 p p 1 2 2 5 w ≡ w 1 − m(m − 1)n B 3− 2− − B − + m − m + 1 n p B − m,np m,n 2 p p 2 6 p 3 5 p 5   + − + + mod p6 vp(m 1) vp(n) vp(wm,n) .

(2) If p = 3, then    32 w ≡ w 1 + m(m − 1)n3 − 34(n − 1)(mn + 1)(mn − n − 1) m,3n m,n 2   + − + + mod 36 v3(m 1) v3(n) v3(wm,n) .

Proof. By Proposition 2, for p  5, we have      3 5 mnp mn 2 p p ≡ 1 − mn (mn − n) B 3− 2− − B − np n 2 p p 2 6 p 3      1 2 2 2 2 5 6+v (mn−n)+v ( mn ) + n − mn + m n p B − mod p p p ( n ) . 5 p 5

Similarly,       3mn mn 32 ≡ 1 + mn2(mn − n) − 34(n − 1)(mn + 1)(mn − n − 1) 3n n 2   6+v (mn−n)+v ( mn ) mod 3 3 3 ( n ) .   mn − The results now follow upon division of the above congruences by m, noting that vp n vp(m) = vp(wm,n). 2

Remark 7. Reducing the moduli, and using Remark 4, we get, for a prime p and for any positive integers m, n, the following congruences:

+ − + +  ≡ − 1 − 3 3 4 vp(m 1) vp(n) vp(wm,n) (1) If p 5, then wm,np wm,n(1 3 m(m 1)n p Bp−3)(mod p ). 2 + − + + ≡ + 3 − 3 4 v3(m 1) v3(n) v3(wm,n) (2) wm,3n wm,n(1 2 m(m 1)n )(mod 3 ). 3 4+v (m−1)+v (n)+v (w ) (3) wm,2n ≡ wm,n(1 + 2(m − 1)n (m − mn + n)) (mod 2 2 2 2 m,n ). 492 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499

Corollary 1. Let p be a prime number, and m a positive integer.

(1) If p  5, then   3 5   p p 1 2 5 w ≡ 1 − m(m − 1) B 3− 2− − B − + m − m + 1 p B − m,p 2 p p 2 6 p 3 5 p 5   + − mod p6 vp(m 1) .

+ − ≡ − 1 − 3 4 vp(m 1) In particular, wm,p 1 3 m(m 1)p Bp−3 (mod p ), and therefore 3 wm,p ≡ 1 (mod p ). = = + 32 − (2) If p 3, then wm,3 1 2 m(m 1). (3) If p = 2, then wm,2 = 1 + 2(m − 1).

For p  5, this follows from Proposition 3 by taking n = 1, since wm,1 = 1 for all positive integers m.Forp = 3 and p = 2, this follows from the definition.

Corollary 2. For any prime p  5 and any positive integer k, we have

≡ k+3 (1) wpk+1,p 1 (mod p ). ≡ k+3 (2) wpk,p 1 (mod p ). 4 (3) In particular, wp+1,p ≡ wp,p ≡ 1 (mod p ).

Specializing to m = 2, we deduce from Proposition 3 the following results concerning the = 1 2n Wolstenholme binomial coefficients wn 2 n .

Proposition 4. Let p be a prime number, and n a positive integer.

(1) If p  5, then   1 6   3 3 3 5 5 5 6+vp(n)+vp(wn) w ≡ w 1 − n p B 3− 2− + n p B − − n p B − mod p . np n p p 2 3 p 3 5 p 5

(2) If p = 3, then    2 3 4 3 2 6+v3(n)+v3(wn) W3n ≡ wn 1 + 3 n − 2 · 3 n (n − 1) (2n + 1) mod 3 .

Remark 8. Reducing the moduli, and using Remark 7, we get, for a prime p and any positive integer n:

+ + ≡ − 2 3 3 4 vp(n) vp(wn)  (1) wnp wn(1 3 n p Bp−3)(mod p ),forp 5. 2 3 4+v (n)+v (w ) (2) w3n ≡ wn(1 + 3 n )(mod 3 3 3 n ). 3 4+v (n)+v (w ) (3) w2n ≡ wn(1 − 2n (n − 2)) (mod 2 2 2 n ).

Corollary 1. For any prime p, and any positive integers k,n, we have

+ + + ≡ 4 k vp(n) vp(wn) (1) wnp k+1 wnp k (mod p ). C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499 493

+ + ≡ 5 vp(n) vp(wn) (2) wnp k wnp (mod p ). ≡ 5 (3) wpk wp (mod p ). + + +  ≡ 3 vp(n) vp(wn) min(1,vp(n)) (4) If p 5, then wnp k wn (mod p ). + + + · ≡ 2 v3(n) v3(wn) 2 min(1,v3(n)) (5) w3kn wn (mod 3 ). + + + · ≡ 1 v2(n) v2(wn) 3 min(1,v2(n)) (6) w2kn wn (mod 2 ).

3+v (n)+v (w )+min(1,v (n)) Proof. (1) In view of Proposition 4, if p  5, then wnp ≡ wn (mod p p p n p ); 2+v (n)+v (w )+2·min(1,v (n)) and w3n ≡ wn (mod 3 3 3 n 3 ). Also, in view of Remark 8, w2n ≡ wn 1+v (n)+v (w )+3·min(1,v (n)) (mod 2 2 2 n 2 ). Moreover, vp(wnp ) = vp(wn), since vp(wnp − wn)  1 + =  vp(wn)>vp(wn), so that vp(wnp k ) vp(wn),fork 0. From these congruences, (1) follows immediately. (2)–(6) are then established by induction on k. 2

Corollary 2. For any prime p  5, we have

≡ − 3 + 1 5 − 6 5 6 (1) wp 1 p Bp3−p2−2 3 p Bp−3 5 p Bp−5 (mod p ). ≡ − 2 3 4 ≡ 3 (2) In particular, wp 1 3 p Bp−3 (mod p ), and therefore wp 1 (mod p ).

Corollary 3. For any prime p  5 and any integer k  2, we have

+ ≡ − − 2 3k k 5) (1) wpk wpk 1 (1 3 p Bp−3)(mod p .  ≡ k+5) (2) If k 3, then wpk wpk−1 (mod p . ≡ 6 (3) In particular, wpk wp (mod p ).

≡ − 3k k+5) Proof. It follows from Proposition 4 that wpk wpk−1 (1 p Bp3−p2−2)(mod p . More- ≡ 2 over, by the Kummer congruences, Bp3−p2−2 3 Bp−3 (mod p). Hence the result in (1). As to (2) and (3), they are immediate consequences of (1) (by an induction in (3)). 2

Corollary 4. Let p and q be distinct prime numbers  5.

3 3 (1) We have wpq ≡ wq (mod p ) and wpq ≡ wp (mod q ). 3 3 3 (2) Thus, wpq ≡ 1 (mod (pq) ) if and only if wq ≡ 1 (mod p ) and wp ≡ 1 (mod q ).

Note 1. Corollary 4 is a direct consequence of formulas (1) and (2) in [M]. Indeed, for dis- 3 3 tinct primes p,q  5, it follows from these formulas that wpq ≡ wpwq (mod p q ), and 3 3 wp ≡ 1 (mod p ) and wq ≡ 1 (mod q ), which yields Corollary 4.

Corollary 5. For any prime p  5, we have

≡ ≡ − 3 + 5 1 − 6 6 (1) wp2 wp 1 p Bp3−p2−2 p ( 3 Bp−3 5 Bp−5)(mod p ). ≡ ≡ − 3 − p 5 (2) wp2 wp 1 p (1 2 )Bp2−p−2 (mod p ). ≡ ≡ − 2 3 4 (3) wp2 wp 1 3 p Bp−3 (mod p ). ≡ 6 ⇔ ≡ 6 ⇔ ≡ 2 1 − 6 3 (4) wp2 1 (mod p ) wp 1 (mod p ) Bp3−p2−2 p ( 3 Bp−3 5 Bp−5)(mod p ). ≡ 5 ⇔ ≡ 5 ⇔ ≡ 2 (5) wp2 1 (mod p ) wp 1 (mod p ) Bp2−p−2 0 (mod p ). ≡ 4 ⇔ ≡ 4 ⇔ ≡ (6) wp2 1 (mod p ) wp 1 (mod p ) Bp−3 0 (mod p). 494 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499

Proof. (1) and (3) follow from Corollaries 2 and 3. (2) follows from (1) by reduction to the modulus p5, using the Kummer congruences to note that   3 − 2 −   p p 2 2 p 2 B 3− 2− ≡ B 2− − ≡ B 2− − ≡ 1 − B 2− − mod p . p p 2 p2 − p − 2 p p 2 p + 2 p p 2 2 p p 2

(4), (5) and (6) follow from (1), (2) and (3), respectively. 2

Remark 9. The conditions in Corollary 5 can be put in a form more easily verifiable by com- putation, through the use of the following congruences for Bernoulli numbers, also due to Kummer [K]. Let p be a prime number and m, n be positive integers such that m is even, (p − 1) m, and n

We also recall the more familiar Kummer congruences [IR] that we have already used in the proofs of Lemma 3 and Corollaries 3 and 5 above. Let p be a prime number and m, m,n be positive integers such that m, m are even, not divisible by (p − 1), and both >n.Ifm ≡ m(mod ϕ(pn)), where ϕ(pn) = pn−1(p − 1) is Euler’s function, then

B  B   m ≡ m mod pn . (2) m m Applying (1) to the case m = ϕ(pn) − 2, where the prime p  7 and n is any positive integer, Bm+k(p−1) Bk(p−1)−2 n   and using (2) to replace m+k(p−1) by k(p−1)−2 , modulo p ,for1 k n, we get   n   Bpn−pn−1− + n Bk(p− )− 2 ≡ (−1)k 1 1 2 mod pn . (3) pn − pn−1 − 2 k k(p − 1) − 2 k=1

In particular, for n = 2, we deduce that for any prime p  7, + +   p 2 2(p 2) 2 B 2− − ≡ B − − B − mod p . (4) p p 2 2p − 4 2p 4 p − 3 p 3

Similarly, for n = 3 and any prime p  7,       2 3 3 1 3 B 3− 2− ≡ p + 2 B − − B − − B − mod p . (5) p p 2 2p − 4 2p 4 p − 3 p 3 3p − 5 3p 5

Moreover, for any integers a,b,n such that p b and n>0, we have

− 1 1 n 1 akpk   ≡− mod pn . ap − b b bk k=0 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499 495

B2p−4 ≡ B3p−5 ≡ Bp−3 Bp−3 − B2p−4 + B3p−5 ≡ 2 Also, by (2), 2p−4 3p−5 p−3 (mod p), and, by (1), p−3 2 2p−4 3p−5 0 (mod p ). Using these congruences in (4) and in (5) respectively, we get

  4 1 4 2 B 2− − ≡ B − − B − + pB − mod p (6) p p 2 3 p 3 2 2p 4 9 p 3 and   3 2 4 3 B 3− 2− ≡ 2B − − B − + B − + p B − − B − p p 2 p 3 2 2p 4 5 3p 5 15 p 3 20 2p 4   29 2 3 + p B − mod p . (7) 90 p 3

Substituting (6) and (7) into the first two expressions of Corollary 5, we deduce the following additional results.

Corollary 6. For any prime p  7, we have

≡ − 3 4 − 1 − 1 4 5 (1) wp 1 p ( 3 Bp−3 2 B2p−4) 9 p Bp−3 (mod p ). ≡ − 3 − 3 + 2 − 4 4 − 3 + 5 1 − (2) wp 1 p (2Bp−3 2 B2p−4 5 B3p−5) p ( 15 Bp−3 20 B2p−4) p ( 90 Bp−3 6 6 5 Bp−5)(mod p ). (3) The following conditions are equivalent: ≡ 5 (i) wp2 1 (mod p ), 5 (ii) wp ≡ 1 (mod p ), ≡ ≡ 8 2 (iii) Bp−3 0 (mod p) and B2p−4 3 Bp−3 (mod p ). (4) The following conditions are equivalent: ≡ 6 (i) wp2 1 (mod p ), 6 (ii) wp ≡ 1 (mod p ), ≡ ≡ 8 2 − 3 + 2 − (iii) Bp−3 0 (mod p) and B2p−4 3 Bp−3 (mod p ) and 2Bp−3 2 B2p−4 5 B3p−5 2 + 6 2 ≡ 3 15 pBp−3 5 p Bp−5 0 (mod p ).

Remark 10. Let p be a prime number and m, r two positive integers. From the definition, = = 2r + r + 2 we have wmp+r cm(p, r)wmp , where cm(p, r) ( i=1(2mp i))/( i=1(mp i)) .In particular, if 1  r  p − 1, then the denominator of cm(p, r) is relatively prime to p and is congruent to r!2 modulo p, while the numerator is congruent to (2r)! modulo p, so that ≡ 2r cm(p, r) r (mod p). Thus

wmp+r ≡ 2wmwr (mod p), for 1  r  p − 1.

It follows that if r is a positive integer and p is a prime factor of wr such that p>r, then p is a prime factor of wn for every positive integer n ≡ r(mod p). = = + + ≡ In the special case where r 1, we further have cm(p, 1) 2(2mp 1)/(mp 1) + h−1 − k k k h 2(2mp 1) k=0( 1) m p (mod p ), for any positive integer h. It follows, in view of Re- mark 8, that if p  5, then 496 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499      2 2 3 3 2 4 w + ≡ 2w 1 + mp − m p + m p 1 − B − mod p . mp 1 m 3 p 3

A similar, but more complicated, congruence holds modulo p6, in view of Proposition 4.     2n+1 = 2(2n+1) 2n−1 = Remark 11. For any positive integer n,wehave n n+1 n−1 , so that wn+1 2(2n+1) + + + n+1 wn. Since n 1 and 2n 1 are relatively prime, it follows that n 1 divides 2wn and + − + n+1 2n 1 divides wn+1. Thus wn is divisible by 2n 1 and also by either n 1or 2 according to whether n is even or odd.

5. The converse of Wolstenholme’s theorem

The converse of Wolstenholme’s theorem stipulates that if n is a composite positive integer, then wn satisfies the condition

3 (CW) wn ≡ 1 (mod n ).

In what follows, we give several infinite families of composite integers n satisfying (CW).

Proposition 5.

3 (1) For any positive integers m, k and any prime p  5 such that p (wm − 1), the integer n = mp k satisfies (CW). 2 k (2) For any positive integers m, k such that 3 (wm − 1), the integer n = 3 m satisfies wn ≡ 1 (mod n2), and therefore n satisfies (CW). 6 (3) For any prime p  5 such that wp ≡ 1 (mod p ), and any integer k  2, the n = pk satisfies (CW). (4) For any prime p  3 and any positive integer m such that m

≡ 3 ≡ 2 Proof. By Corollary 1 to Proposition 4, wmp k wm (mod p ) and w3km wm (mod 3 ),for 3 primes p  5 and integers k  1. So the condition wm ≡ 1 (mod p ) (respectively wm ≡ 1 2 ≡ 3 ≡ k 3 (mod 3 )) implies that wmp k 1 (mod p ) hence wmp k 1 (mod (mp ) ) (respectively ≡ 2 ≡ k 2 w3km 1 (mod 3 ) hence w3km 1 (mod (3 m) )). This proves (1) and (2). ≡ 6 ≡ 6 By Corollary 3 to Proposition 4, wpk wp (mod p ). So the condition wp 1 (mod p ) ≡ 6 ≡ k 3  implies that wpk 1 (mod p ) hence wpk 1 (mod (p ) ),fork 2. This gives (3).   !− · ! 2 If m

 −  Note 2. In [M, p. 387], it is shown that if n = p2 satisfies 2n 1 ≡ 1 (mod n3), then p satisfies   n−1 2p−1 ≡ 6 ≡ 6 p−1 1 (mod p ). But then, it easily follows from (1) and (2) in [M] that wpk wp (mod p ) for all positive integers k, which gives the property (3) in Proposition 5 above.

Remark 12. According to the computations reported in [MR], there are only two prime numbers 9 4 p<10 (called Wolstenholme primes) satisfying wp ≡ 1 (mod p ), i.e. satisfying Bp−3 ≡ 0 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499 497

(mod p), namely p1 = 16843 and p2 = 2124679. Therefore, in view of Corollary 1 to Propo- 9 sition 4, for all primes 5  p<10 other than p1 and p2, and for all positive integers k,we − = − = have vp(wpk 1) vp(wp 1) 3. Moreover, we checked with the PARI-GP calculator that 8 − ≡ − 2 ≡ 5 B2p1 4 3 Bp1 3 (mod p1), so that in view of Corollary 6 to Proposition 4, wp1 1 (mod p1). − = − = Therefore vp1 (w k 1) vp1 (wp1 1) 4 for all positive integers k. Thus, in view of Propo- p1 9 sition 5, for all primes 5  p<10 other than p2 and for all integers k  2, the prime power n = pk satisfies (CW). We also computed the factorization of wm − 1for2 m  149 and found that, for these values of m, the difference wm − 1 has no cubic factors except when m is the power of a prime p  5, for which vp(wm − 1) = 3; or when m = 39 or m = 117, for which v3(wm − 1) = 3. This raises the question of determining the integers m  2, that are not prime powers, for which wm − 1 has a cubic factor. A related question is that of determining the primes p for which wp − 1 has a cubic factor prime to p. A further question is to determine the pairs of distinct primes p,q such that p | (wq − 1) and q | (wp − 1). In view of Corollary 4 to Proposition 4, the last two conditions together amount to the condition that n = pq satisfies the congruence wn ≡ 1 (mod n). In [M], three such solutions n to this congruence are given, namely n = 29×937 and n = 787×2543 and n = 69239×231433, of which the first two are the only solutions n<109 which are not prime powers. A simpler question is thus whether the congruence wn ≡ 1(mod n) has infinitely many solutions that are not prime powers.

Proposition 6. Let n be an integer > 1.

(1) If n is not a power of 2, then wn ≡ 0 (mod 2). (2) If n is a power of 2, then wn ≡ 3 (mod 32). (3) If n is even and n>2, then wn ≡ 1 (mod n). In particular, all positive even integers n satisfy (CW).

= h i ∈{ } Proof. By a theorem of Legendre [Gr,Ri], if n i=0 2 ni , with all ni 0, 1 , is the 2-adic de- velopment of n, then the 2-adic valuation of n! is given by v (n!) = n− n . Moreover, since 2 i0 i = h i+1 ! = − 2n i=0 2 ni has the same non-zero 2-adic digits as n, then v2((2n) ) 2n i0 ni , and therefore     2n      v = v (2n)! − 2v (n!) = 2n − n − 2 n − n = n . 2 n 2 2 i i i i0 i0 i0   2n In other words, v2 n is equal to the number of non-zero 2-adic digits of n.Thus,if n is 2n  not a power  of 2, then it has at least two non-zero 2-adic digits, and therefore v2 n 2, i.e. = 1 2n ≡ wn 2 n 0 (mod 2). This proves (1). ≡ 5 On the other hand, by Corollary 1 to Proposition 4, w2k w2 (mod 2 ), for any positive integer k. Since w2 = 3, this gives (2). As to (3), it results immediately from (1) and (2). 2

Note 3. Property (3) of Proposition 6 was already obtained by R.J. McIntosh, who gave a proof of it in the original manuscript [M1] of [M]. 498 C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499

 = h i Lemma 6. Let n be a positive integer, p a prime number 3, and n i=0 nip be the p-adic development of n, where the integers ni satisfy 0  ni  p − 1 for 0  i  h.

+ We have p | w if and only if n  p 1 for at least one i ∈{ , ,...,h}. (1) n   i  2 0 1   1 h 2ni 0 (2) If p w , then w ≡ = (mod p), where, by definition, = 1. n n 2 i 0 ni 0     2n 2n Proof. (1) By a theorem of Kummer [Gr,Ri], the p-adic valuation vp n of n is equal to the = 1 2n = number of “carries” when adding n and n in base p. Since wn 2 n and the prime p 2, it = 2n follows that vp(wn) vp n > 1 if and only if there is at least one “carry” in the addition of n and n in base p, which means that for at least one i, the sum of the p-adic digits ni + ni >p− 1,  p+1 i.e. ni 2 . Hence the first result.   p−1   (2) If p wn, then, by what precedes, 0 ni 2 for 0 i h, so that the inte- gers 2ni are exactly the p-adic digits of 2n. Then, by a theorem of Lucas [Gr,Ri], we have 2n h 2ni ≡ = (mod p). Hence the second result. 2 n i 0 ni

Proposition 7. Let n be an integer > 1.

(1) We have wn ≡ 0 (mod 3) if and only if n is not the sum of distinct powers of 3. r−1 (2) If n is the sum of r distinct powers of 3, then wn ≡ (−1) (mod 3). (3) If 3 | n, and either n is not the sum of distinct powers of 3 or n is the sum of an even number of distinct powers of 3, then wn ≡ 1 (mod n), and therefore n satisfies (CW). ≡ 5 (4) For any positive integer k, we have w3k 10 (mod 3 ). Thus, if n is a power of 3, then 3 v3(wn − 1) = 2, so that wn ≡ 1 (mod 3 ), and therefore n satisfies (CW).

= h i  Proof. Let n i=0 ni3 be the 3-adic development of n, where the integers ni satisfy 0 ni  2for0 i  h. ≡  = (1) By Lemma 6, wn 0 (mod 3) if and only if at least one ni 2, i.e. not all ni 0or1,i.e. r ij  ···  n is not of the form j=1 3 , with 0 i1

Acknowledgment

We would like to thank the referee who pointed out some missed or unknown (to the authors) references. C. Helou, G. Terjanian / Journal of Number Theory 128 (2008) 475–499 499

References

[D] L.E. Dickson, History of the Theory of Numbers, vol. 1, Chelsea, New York, 1966. [Gr] A. Granville, Arithmetic properties of binomial coefficients. I. Binomial coefficients modulo prime powers, in: Organic Mathematics, Burnaby, BC, 1995, in: CMS Conf. Proc., vol. 20, Amer. Math. Soc., Providence, RI, 1997, pp. 253–276. [Gu] R. Guy, Unsolved Problems in Number Theory, third ed., Springer, New York, 2004. [HW] G.H. Hardy, E.M. Wright, An Introduction to the Theory of Numbers, fifth ed., Oxford University Press, 1979. [IR] K. Ireland, M. Rosen, A Classical Introduction to Modern Number Theory, second ed., Springer, New York, 1990. [K] E.E. Kummer, Über eine allgemeine Eigenschaft der rationalen Entwicklungscoefficienten einer bestimmten Gat- tung analytischer Functionen, J. Reine Angew. Math. 41 (1851) 368–372. [M] R.J. McIntosh, On the converse of Wolstenholme’s theorem, Acta Arith. 71 (1995) 381–389. [M1] R.J. McIntosh, On primality and Wolstenholme’s theorem, preprint, 1994. [MR] R.J. McIntosh, E.L. Roettger, A search for Fibonacci–Wieferich and Wolstenholme primes, Math. Comp. 76 (2007) 2087–2094. [Ri] P. Ribenboim, The New Book of Prime Number Records, third ed., Springer, New York, 1996. [Ro] A.M. Robert, A Course in p-Adic Analysis, Springer, New York, 2000. [W] J. Wolstenholme, On certain properties of prime numbers, Quart. J. Pure Appl. Math. 5 (1862) 35–39.