
Numerators of harmonic numbers - ColinWright
http://www.johndcook.com/blog/2015/07/19/numerators-of-harmonic-numbers/
======
gjm11
Wolstenholme's theorem that the numerator of H_{p-1} is a multiple of p^2 is a
bit tricky to prove, but the weaker result that the numerator is a multiple of
p is very straightforward. Here are two ways.

ONE

Multiply through by P := 1.2.3...(p-1); note that if a fraction's numerator is
a multiple of p after doing this, it must have been before as well. Now what
we have is obviously an integer; it's P/1 + P/2 + P/3 + ... + P/(p-1).

Clearly none of these terms is a multiple of p. And no two of these terms can
be equal mod p, because if P/a-P/b is a multiple of p then so is ab(P/a-P/b) =
(b-a)P, but that's impossible: neither b-a nor P is a multiple of p, and p is
prime.

So their values mod p must be 1,2,3,...,p-1 in some order, and when you add
those up you get a multiple of p. We're done.

(For an audience familiar with the relevant ideas, this can be considerably
abbreviated: "Mod p, this is the sum of the inverses of 1,2,...,p-1, and these
are just 1,2,...,p-1 in some order, whose sum is 0, QED.")

TWO

Group the fractions in pairs: 1/k and 1/(p-k). The sum of each pair is
p/k(p-k) and of course when we add these up the numerator is still a multiple
of p (because there are no p's in the denominator). Done.

(I think the first of these is _really_ the simpler and more informative of
the two, even though the second is shorter.)

------
divs1210
Is it true only for primes? Is there a case for which the rule holds but p
isn't prime?

~~~
ColinWright
Have you actually tried it? There is code in the article - have you tried
running it? If so, what have you tried, and what answers did you get? If not,
why not?

~~~
divs1210
I've tried it, and used it to test primality. Then I thought I might be
biased.

[http://pizzaforthought.blogspot.in/2015/07/prime.html](http://pizzaforthought.blogspot.in/2015/07/prime.html)

~~~
ColinWright
Looking carefully, you have this very, very wrong. You've said:

    
    
        Today I found something called Wolstenholme’s
        theorem, which says: 
    
            A number n (> 3) is prime if the numerator
            of H(n-1) is a multiple of n², where
            H(n) =  1/1 + 1/2 + ... 1/n
    

No, no, no, no, no ...

The theorem says:

    
    
            For a prime p > 3, the numerator of H_{p-1}
            is divisible by p^2.
    

You have your "if" condition the wrong way round.

I've tried to comment on your blog, but it requires a login using any of
several techniques, none of which I use, and none of which I'm willing to
create just for this. So I didn't.

~~~
divs1210
Thank you for taking out the time. I've updated my post now.

