I didn't use divisions or remainders, only multiplications. I've
changed it so it only uses addition and now it still doesn't
outperform a version that only checks odd's. it's not as fast as your
version where every index corresponds to i*2+1 because I fill every
even number with false...
I tried using 6k+-1 for all primes and for some reason it
performed
slower. I think I have something completely inefficient
somewhere,
can't figure out where though.
You aren't, by any chance, using divisions or remainders? those
are much slower than, say, multiplications (unless the divisor
i
I tried using 6k+-1 for all primes and for some reason it performed
slower. I think I have something completely inefficient somewhere,
can't figure out where though.
I think it has something to do with me increasing k and then
multiplying with k while I could have simply added 6 to K...
and I have
On Sunday, 27 May 2012 at 17:00:01 UTC, maarten van damme wrote:
ok, can't seem to reproduce the crashing. now on to optimizing
my
sieve a bit more ,9 miliseconds for 1_000_000 is still to slow.
--
Er is zon buiten. Zonnige zondag namiddag met priemgetallen in
de
plaats van buiten zitten. Tss
ok, can't seem to reproduce the crashing. now on to optimizing my
sieve a bit more ,9 miliseconds for 1_000_000 is still to slow.
--
Er is zon buiten. Zonnige zondag namiddag met priemgetallen in de
plaats van buiten zitten. Tss tss. :-)
hoe? wie? x)
I ran in two problems. It was extremely fast when sieving a
byte array
of 1 million entries (without optimizations at all) but when
trying
with 10_000_000 entries the program crashes before it even
starts to
execute (main isn't reached).
You say it does compile, but then crashes immediatly? I
On 05/27/2012 02:10 PM, maarten van damme wrote:
thank you :)
I wrote a sieve of aristotle because atkin's sieve needed waay to many
optimizations to beat aristotle's sieve by even a little bit so I
wanted to see if aristotle's was good enough.
I ran in two problems. It was extremely fast when
thank you :)
I wrote a sieve of aristotle because atkin's sieve needed waay to many
optimizations to beat aristotle's sieve by even a little bit so I
wanted to see if aristotle's was good enough.
I ran in two problems. It was extremely fast when sieving a byte array
of 1 million entries (without
On 05/27/2012 01:18 PM, maarten van damme wrote:
well, maybe, looking back at it, a range isn't the ideal way to go
about generating primes easily. I'm going to implement the sieve of
Atkin and make it return an array of primes up to a given number. This
might be a bit more useful and fast.
Is t
well, maybe, looking back at it, a range isn't the ideal way to go
about generating primes easily. I'm going to implement the sieve of
Atkin and make it return an array of primes up to a given number. This
might be a bit more useful and fast.
Is there somewhere I can catch up on ctfe? after readin
On Saturday, 26 May 2012 at 18:40:53 UTC, maarten van damme wrote:
well, I was thinking about using a sieve but when you were to
request
prime 400_000 you're sieve would blow up in size.
Because you only need primes up to sqrt(n) to check if n is prime,
you can make a sieve based range that on
well, I was thinking about using a sieve but when you were to request
prime 400_000 you're sieve would blow up in size. That's why I opted
for something else (and I don't know if it was the right thing to do
though). (Ab)using opIndex like that is indeed a bit wrong but what
would be the alternativ
On Saturday, 26 May 2012 at 13:49:53 UTC, maarten van damme wrote:
Is there an easy way to speed up or is this the
ceiling?
I got a 30 percent speedup by replacing this line:
if(&& canFind(quicktestPrimes, possiblePrime))
with this:
if(quicktestPrimes.back >= possiblePrime &&
canFind(qui
On 05/26/2012 03:49 PM, maarten van damme wrote:
I finally made the primerange I wanted to make. I think I'm using a
rather dumb algorithm. The idea is to store the prime we're at in
curPrime and the amount of preceding primes in countPrime. Then
opindex is able to calculate how many primes follo
I finally made the primerange I wanted to make. I think I'm using a
rather dumb algorithm. The idea is to store the prime we're at in
curPrime and the amount of preceding primes in countPrime. Then
opindex is able to calculate how many primes following or preceding
curPrime we have to find to get t
15 matches
Mail list logo