mersenneforum.org The Next Prime Gap Project
 Register FAQ Search Today's Posts Mark Forums Read

2018-10-22, 04:41   #111
robert44444uk

Jun 2003
Oxford, UK

1,979 Posts

Quote:
 Originally Posted by danaj If you send me your programs and process I'll see if I can find time. All the Chinese code is in C and C+GMP (depending on which you need), or we just leave it and write a simple input translation.
Two bits are needed. ATH output is the number of even numbers after p# plus offset before the first instance of 0modp for each of the odd p in p#. This needs to be translated into the value n in nmodp for each p (including p=2 in p# being the true equivalence at p#+offset.

The second bit is the concatenation needed to get these into the right format for the CRT computation. In Perl this is Chinese[ (n1,p1),(n2,p2).....]

Oh and the p#+offset is always 1mod2 in ATHs program.

 2018-10-22, 08:52 #112 ATH Einyen     Dec 2003 Denmark 32·5·71 Posts Maybe I can add it to the program. The CRT offset is the beginning of the interval? So if interval is for example n to n+1650, with n odd, you want: n mod p# ?
2018-10-22, 13:32   #113
robert44444uk

Jun 2003
Oxford, UK

1,979 Posts

Quote:
 Originally Posted by ATH Maybe I can add it to the program. The CRT offset is the beginning of the interval? So if interval is for example n to n+1650, with n odd, you want: n mod p# ?
That's the best idea. For my searches I add half of the range and search either side with danaj's surround_prime utility in Perl.

 2018-10-23, 21:39 #114 ATH Einyen     Dec 2003 Denmark 319510 Posts It will add CRT value now to the results file primeinterval-.txt. It is the middle of the interval, so subtract "interval/2" to get the start of the interval. To get CRT values from old results for example primeinterval1450-31.txt run: primeinterval.exe primeinterval1450-31.txt 204 to get CRT values for solutions with value 204, writing them to screen and also to the file primeinterval1450-31CRT.txt primeinterval.c Last fiddled with by ATH on 2018-10-23 at 21:42
 2018-10-30, 04:02 #115 robert44444uk     Jun 2003 Oxford, UK 1,979 Posts Thanks ATH - I'm sure to use! I just got back from a trip and was very happy to see that the best offset at 79# working over an integer range of 2200 produced 43 gap records in 10 days of processing. The record gaps ranged from 2426 to 2988. Numerous records were broken more than once. Three gaps had a merit greater than 30. I was looking at the minus version i.e. A * 79# - offset - 1100, with A from 1 to approx. 220 billion. This range of A contained 20395 gaps of 2000 or more. A gap of 2000 for this size of primorial is 21 merit approximately. I'm convinced that ATH's program is a powerful tool in the effort to get to new gap records, and I am thinking I'll start a separate thread to start to coordinate other people's efforts so that we don't overlap efforts. That is, if others are interested. Last fiddled with by robert44444uk on 2018-10-30 at 04:09
 2018-10-30, 05:41 #116 ATH Einyen     Dec 2003 Denmark 1100011110112 Posts Very nice to see it is useful, a program that originally was just a 20-30 min thing I made to check if I could beat your "record" in the first interval. I'm sure better programmers like Dana or others here in the forum could make a faster version if they tried. Last fiddled with by ATH on 2018-10-30 at 05:42
 2018-11-02, 06:57 #117 ATH Einyen     Dec 2003 Denmark 32·5·71 Posts Here is a version using GMP library to calculate CRT offsets, so it can go beyond maxprime 101: primeinterval.c No real maximum now, but it gets messy. I tested at the 1700 interval and already at maxprime=73 there are 11.5K solutions with minimum+2 and it finds more and more solutions if you continue to run min, min+1 and min+2 to higher values. What is the best maxprime for 1700 interval? Then I can provide some CRT offsets, I did a full run to maxp=37 and ran the best solutions higher, but I'm not going to use them for any prime gap search. I do not think we want to save min+3 and min+4 solutions like you suggested. I tested at 1700 maxp=29 and 1250 maxp=31 and there were 4.5K / 11K min+3 solutions and 25K / 111K min+4 solutions and running all those would take a very long time, and that would just give too many solutions at higher maxprimes. I changed the way it resumes from earlier file. Instead of running it 2-3 times with the min value, min+1, min+2, you just run it once with the minimum value: (example 1700 maxp 37 minimum 231 running it to maxp=59): primeinterval.exe 59 primeinterval1700-37.txt 231 It will test all the 231 solutions first and then continue automatically with the 232 solutions and 233 solutions and you can stop it at any time with CTRL+C if it takes too long, and use the best it found so far in the primeinterval1700-59.txt file. Last fiddled with by ATH on 2018-11-02 at 07:02
 2018-11-02, 09:49 #118 robert44444uk     Jun 2003 Oxford, UK 197910 Posts Brilliant, look forward to taking this forward for the 4000s. To me, rather than save all those solutions, starting at 31, you could set expected minima for each level of prime and each level of interval, and then run all 31 solutions within 5 of the expected minimum up to whatever level you are proposing, stopping if it gets 5 behind. I think you could jump two primes at a time. The secret is to run the 31 solution right the way up to the end point or dropping it at an intermediate point before moving on to the next 31 solution. Then print out only those that are within 2 of the theoretical best. I think the processing time would come down as well as the size of output file. Just run 3000 up to 101, and my best solutions are at 289 positions with no small factors. Also ran the minus version of the same offset for 79# mentioned in yesterday's post. I got 6 new records from 2500 to 2800 with a top merit of 30.
2018-11-02, 10:12   #119
robert44444uk

Jun 2003
Oxford, UK

1,979 Posts

Quote:
 Originally Posted by ATH Here is a version using GMP library to calculate CRT offsets, so it can go beyond maxprime 101: primeinterval.c
Oh, I'm having problems because I've got to install GMP and I'm having problems. I've tried from this page https://cs.nyu.edu/~exact/core/gmp/index.html but nothing seems to be working. There must be a simpler way than the way they are suggesting - it is so simple in Strawberry Perl.

I put the gmp-dynamic-mingw-4.1.tar.gz file into my working msys personal file and then run a batch

cd ${gmp_build} tar xzvf${gmp_download}/gmp-dynamic-mingw-4.1.tar.gz
cd gmp-dynamic-mingw-4.1
./configure --prefix=${gmp_install} --disable-static --enable-shared make make install it does the following x gmp/include/ x gmp/include/gmp.h x gmp/info/ x gmp/info/gmp.info x gmp/info/gmp.info-1 x gmp/info/gmp.info-2 x gmp/info/gmp.info-3 x gmp/info/gmp.info-4 x gmp/info/gmp.info-5 x gmp/info/gmp.info-6 x gmp/info/gmp.info-7 x gmp/info/gmp.info-8 x gmp/lib/ x gmp/lib/libgmp-3.dll x gmp/lib/libgmp.la x gmp/ Then at the next instruction falls down$ cd gmp-dynamic-mingw-4.1
bash: cd: gmp-dynamic-mingw-4.1: No such file or directory

Last fiddled with by robert44444uk on 2018-11-02 at 11:01

2018-11-02, 15:06   #120
ATH
Einyen

Dec 2003
Denmark

32·5·71 Posts

Get GMP library here:

Extract the file with 7-zip and then again extract the "gmp-6.1.2.tar" file with 7-zip which will extract the "gmp-6.1.2" directory.

In MSYS2 in the "gmp-6.1.2" directory run:

./configure ABI=64 CC=gcc CFLAGS="-O3 -m64" --enable-static --disable-shared
make
make install
make check

(It will make the files C:\msys64\usr\include\gmp.h and C:\msys64\usr\lib\libgmp.a and C:\msys64\usr\lib\libgmp.la)

To compile the program with GMP:
g++ -m64 -O3 -I /usr/include -L /usr/lib primeinterval.c -o primeinterval.exe -lgmp

Quote:
 Originally Posted by robert44444uk To me, rather than save all those solutions, starting at 31, you could set expected minima for each level of prime and each level of interval, and then run all 31 solutions within 5 of the expected minimum up to whatever level you are proposing, stopping if it gets 5 behind. I think you could jump two primes at a time. The secret is to run the 31 solution right the way up to the end point or dropping it at an intermediate point before moving on to the next 31 solution. Then print out only those that are within 2 of the theoretical best. I think the processing time would come down as well as the size of output file.
I'm not sure I follow you. In my test on the 1250 interval at maxp=31, the minium is 174 (12 solutions) and then there are 214 solutions at 175, 2114 solutions at 176, 17920 solutions at 177 and 111716 solutions at 178. Running all those 131976 solutions higher is a lot and they will quickly become millions of solution at higher maxp for solutions "min" to "min+4".

Maybe this is an extreme case, but you can try it, just change:

Line 81+Line 245: "if (j<=(min+2))" to "if (j<=(min+4))"
Line 181: "minval2=minvalue+2;" to "minval2=minvalue+4;"

Last fiddled with by ATH on 2018-11-02 at 15:09

2018-11-02, 17:00   #121
robert44444uk

Jun 2003
Oxford, UK

36738 Posts

Quote:
 Originally Posted by ATH Get GMP library here: https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2 Extract the file with 7-zip and then again extract the "gmp-6.1.2.tar" file with 7-zip which will extract the "gmp-6.1.2" directory. In MSYS2 in the "gmp-6.1.2" directory run:
This is all above my pay grade. So I have the bz2 in my downloads subdirectory and when I extract it extracts to the same downloads subdirectory. Should I have placed the .bz2 file somewhere else before I extracted it?

I copied the gmp-6.1.2 subdirectory into my c:\msys64\ directory and then opened MSYS2 and typed in a CD command (so that I could then run your scripts in that subdirectory)

cd /msys64/gmp-6.1.2

Then I got an error message saying "no such file or directory". So I can't get further.

My basic problem is I have a basic understanding of windows and no understanding at all of Msys!!

 Similar Threads Thread Thread Starter Forum Replies Last Post jasong Open Projects 23 2011-01-22 15:14 jasong Open Projects 5 2008-10-01 06:34 gd_barnes Lounge 0 2008-01-21 09:05 Citrix Lounge 0 2004-06-29 19:54 TTn 15k Search 2 2004-06-22 22:56

All times are UTC. The time now is 06:39.

Mon Nov 29 06:39:12 UTC 2021 up 129 days, 1:08, 0 users, load averages: 1.14, 1.04, 1.00