Re: [go-nuts] fast small prime checker

2018-03-08 Thread ralphdoncaster
It does look interesting, though I think I have a solution using git submodules. On Monday, 5 March 2018 02:26:53 UTC-4, Michael Jones wrote: > > ...if that's how you feel, you'll enjoy the current discussion of vgo. > > On Sun, Mar 4, 2018 at 10:24 PM, > > wrote: > >> >> >> On Monday, 5 March 2

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Michael Jones
...if that's how you feel, you'll enjoy the current discussion of vgo. On Sun, Mar 4, 2018 at 10:24 PM, wrote: > > > On Monday, 5 March 2018 02:13:18 UTC-4, Jan Mercl wrote: >> >> >> On Mon, Mar 5, 2018 at 12:55 AM wrote: >> >> > For my use case, I'll only be checking numbers > 2^18 and < 2^25.

Re: [go-nuts] fast small prime checker

2018-03-04 Thread ralphdoncaster
On Monday, 5 March 2018 02:13:18 UTC-4, Jan Mercl wrote: > > > On Mon, Mar 5, 2018 at 12:55 AM > > wrote: > > > For my use case, I'll only be checking numbers > 2^18 and < 2^25. After > looking at the repo, it's not simple enough to copy primes.go, anyone that > wants to rely on it would have

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Jan Mercl
On Mon, Mar 5, 2018 at 12:55 AM wrote: > For my use case, I'll only be checking numbers > 2^18 and < 2^25. After looking at the repo, it's not simple enough to copy primes.go, anyone that wants to rely on it would have to fork the repo. No need to copy source code or fork the repository. `import

Re: [go-nuts] fast small prime checker

2018-03-04 Thread ralphdoncaster
On Sunday, 4 March 2018 17:07:20 UTC-4, Jan Mercl wrote: > > On Sun, Mar 4, 2018 at 9:38 PM > wrote: > > > The performance looks to be as good or slightly better than my simple > implementation. > > FTR, the performance is in an order of magnitude, or as you put it > "slightly", better in the ca

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Bakul Shah
> On Mar 4, 2018, at 1:40 PM, Bakul Shah wrote: > > >> On Mar 4, 2018, at 12:43 PM, ralphdoncas...@gmail.com wrote: >> >> I am curious to see how you implemented the table lookup. Is the code >> posted somewhere? > > This should easy. Check all odd numbers against primes <= square root of th

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Michael Jones
indeed. i never uploaded that to github. but i could. will look into it. On Sun, Mar 4, 2018 at 1:40 PM, Bakul Shah wrote: > > > On Mar 4, 2018, at 12:43 PM, ralphdoncas...@gmail.com wrote: > > > > I am curious to see how you implemented the table lookup. Is the code > posted somewhere? > > Th

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Bakul Shah
> On Mar 4, 2018, at 12:43 PM, ralphdoncas...@gmail.com wrote: > > I am curious to see how you implemented the table lookup. Is the code posted > somewhere? This should easy. Check all odd numbers against primes <= square root of the candidate number and if prime, add it to primes list. Conver

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Jan Mercl
On Sun, Mar 4, 2018 at 9:38 PM wrote: > The performance looks to be as good or slightly better than my simple implementation. FTR, the performance is in an order of magnitude, or as you put it "slightly", better in the case of uint32 - and probably several orders of magnitude in the other cases

Re: [go-nuts] fast small prime checker

2018-03-04 Thread ralphdoncaster
For my application (an ethereum miner), the prime check is only necessary when generating a cache and DAG, which is about every 5 days (or every time the miner application is restarted). I am curious to see how you implemented the table lookup. Is the code posted somewhere? On Sunday, 4 March

Re: [go-nuts] fast small prime checker

2018-03-04 Thread ralphdoncaster
On Sunday, 4 March 2018 05:41:53 UTC-4, Jan Mercl wrote: > > On Sun, Mar 4, 2018 at 7:27 AM > wrote: > > > It still has room for optimization, but it is much faster than > ProbablyPrime(0) for 32-bit integers. > > > http://nerdralph.blogspot.ca/2018/03/fast-small-prime-checker-in-golang.html > >

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Michael Jones
ProbablyPrime() is for when the number is too big to test authoritatively. For numbers smaller than that, there are two schools of thought. The first is to do what you did, doing a primality test for the number at hand. The second is to use a table of results.The table generally needs to be of si

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Jan Mercl
On Sun, Mar 4, 2018 at 7:27 AM wrote: > It still has room for optimization, but it is much faster than ProbablyPrime(0) for 32-bit integers. > http://nerdralph.blogspot.ca/2018/03/fast-small-prime-checker-in-golang.html You may want to give the primality checking functions of http://github.com/c

[go-nuts] fast small prime checker

2018-03-03 Thread ralphdoncaster
It still has room for optimization, but it is much faster than ProbablyPrime(0) for 32-bit integers. http://nerdralph.blogspot.ca/2018/03/fast-small-prime-checker-in-golang.html -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from