Thread: Cullen prime problem View Single Post
 2006-11-28, 22:57 #9 Citrix     Jun 2003 1,579 Posts For small ranges like people at prothsearch.net work on, my program is slightly slower than yours, but when it comes to just looking cullens where the index is prime, my program becomes several times faster. I assumed this was because, your program calculated the gap in increments of 50 ... etc. Here is the pseudo code, if you still want the real source code, it will take a while to clean it up, before I email it to you. - generate a prime p -calculate the maximum gap between 2 candidates -Create array and store all values 2^1, 2^2 ... 2^max_gap (All mod p), this is done by doing *2 mod p. - Find the largest cullen left unsieved=max. Calculated 2^(-1*max) - Go down from the 2^(-1*max) and multiply it by gaps, consecutively and check if this value equals the index of the cullen number being tested. I assume your program uses this algorithm. For multiplication my program uses 64 bit ints, so program is limited to 32 bits. ( haven't implemented any of the special multiplication speeds up.) Program is compiled under, VC++ 6.0 with some optomizations selected. Not sure if that makes any difference. What do you think?