Hacker News new | past | comments | ask | show | jobs | submit login

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




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.


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


Being true for primes does not mean that it's true only for primes. With regards composites the result (as it stands) says nothing, so for a given composite it might be true or false, and you'd need to test.

That means that if a number fails this test then it's definitely not prime, but if it passes then it may or may not be prime.

However, this link (as included in another comment) gives more information:

https://en.wikipedia.org/wiki/Wolstenholme%27s_theorem#Gener...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: