--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
It's an interesting algorithm.How much faster is it than Miller-Rabin for n=100, say?
I don't think it makes sense to put this in the stdlib. There are two main reasons:1) having ProbablyPrime(n) for n <= 0 trigger your algorithm is hacky at best. The name isn't even correct, as your algorithm is deterministic.
2) having no guarantee, even a probabilistic one, makes this algorithm not terribly useful. Miller-Rabin gives you a strong probability guarantee regardless of the input. Baillie-PSW only gives you "no one has found a counterexample yet".
--
8 primes 660..990 bits in size, their pairwise products, totally 8+7*8/2=36 numbers on my core i5 4210m laptop:
MR(n=100) took 827.089748ms
BPSW took 288.061015ms
11 Kas 2015 13:13 tarihinde "Han-Wen Nienhuys" <han...@google.com> yazdı:
> Acosh cannot be removed because of the compatibility promise.
It was an example for why it should be there. Do you really think I meant to remove it?
Also, in what way does my proposal break compatibility promise?
> There is a big cost to putting anything in the standard library: they
> have to be kept there forever, and no changes to their behavior can
> ever be made. This is a big cost, and the cost had better be worth it.
There is no change in existing behavior, we just extend the function for n<=0.
I agree with your maintenance concerns but it is not a big patch I think.
> In some cases, there might be an overriding reason to put it there
> (eg. if the new functions need access to private data/code of the
> library), but that is not the case here, is it?
Performance, having current algorithms for primality testing, completeness of a basic function in stdlib. These sound pretty good to me for reasons of inclusion.
> Why don't you make it a go-gettable library? If it turns out that this
> is overwhelmingly popular with everyone, it can always be put in the
> std library at a later stage.
Han, you are missing my point. A lucas test by itself does not justify a go-gettable library. Is this how you added Acosh() to stdlib in the first place? Did it become 'overwhelmingly popular' ?
That just sounds funny.
It is a backwards compatible improvement that is necessary for many number theory, crypto applications.
You sound like I am trying to add my custom lousy algorithm for calculating some absurd thing.
It is a popular established published algorithm for a basic function in math/big.
I'm surprised with the amount of resistance :)
11 Kas 2015 13:13 tarihinde "Han-Wen Nienhuys" <han...@google.com> yazdı:
> Why don't you make it a go-gettable library? If it turns out that this
> is overwhelmingly popular with everyone, it can always be put in the
> std library at a later stage.Han, you are missing my point. A lucas test by itself does not justify a go-gettable library. Is this how you added Acosh() to stdlib in the first place? Did it become 'overwhelmingly popular' ?
12 Kas 2015 00:58 tarihinde "Benjamin Measures" <saint....@gmail.com> yazdı:
>
> afaics, your patch adds nothing to the API apart from allowing negative integers to be ProbablePrime. Given the usual definition for a prime number[1], allowing this would be dubious.
> [1] http://mathworld.wolfram.com/PrimeNumber.html
n (of type int) is the number of MR rounds, not the input. Notice that we are talking about a function of the 'big' package.
Thanks to Andrew there is CoC set in place ^_^ cuz you just deserved a good compliment after all this discussion.
12 Kas 2015 00:58 tarihinde "Benjamin Measures" <saint....@gmail.com> yazdı:
>
> afaics, your patch adds nothing to the API apart from allowing negative integers to be ProbablePrime. Given the usual definition for a prime number[1], allowing this would be dubious.
> [1] http://mathworld.wolfram.com/PrimeNumber.htmln (of type int) is the number of MR rounds, not the input. Notice that we are talking about a function of the 'big' package.
--