mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Puzzles (https://www.mersenneforum.org/forumdisplay.php?f=18)
-   -   CRUS-like sieving challenge (https://www.mersenneforum.org/showthread.php?t=16124)

gd_barnes 2011-10-27 21:11

[QUOTE=Batalov;276008]Well, 2^(2^n)-k sieve in k should be an appallingly easy sieve to write from scratch and even without GMP (raising 2^(2^n) mod p is very easy and then just zero some bits), but will it do better than a "sieve" like this?

[CODE]# gp -p 80000000
write("kcan","ABC 2^65536-$a")
forstep(k=17,99999999,12, \
if(k%60==17||k%60==29||k%60==53, \
m=1;forprime(p=7,80000000,if(lift(Mod(2,p)^65536-k)<2,m=0;break)); \
if(m>0,write("kcan",k))) \
)
[/CODE]
and after a bit of time start "pfgw -f0 -llog kcan" in parallel?[/QUOTE]

Is this PARI code? I don't have PARI and am not familiar with it.

Batalov 2011-10-27 22:00

Yes, it is. It is an invaluable tool and is easy to install (not as easy to use, but that's a different story; however, there are experts here on forum who will help). But this is only for prototyping.

I am sure that a plain C 50-liner siever will take care of the problem much easier and faster. I'll probably give it a crack over weekend. One could use the k%60==17||k%60==29||k%60==53 packing in it (or even tighter), or rather I am inclined to just keep only 1 (mod 12) 2Gb byte array (for k<24G) and then clear proper, equally spaced bytes relentlessly for each p until 2^32 or until too bored. :truck:

Batalov 2011-10-28 18:30

1 Attachment(s)
Quick'n'dirty... and lazy (no bit packing or any fancy stuff) and limited to sieving to 2B. Attached. Can be vastly improved (but of course Geoff could write a totally superior sieve with his left foot in 15 minutes).


All times are UTC. The time now is 08:52.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.