PDA

View Full Version : Question about Make_work_to_do



vjs
08-23-2005, 04:32 PM
Mike,

I was wondering how difficult it would be to modify your utility to use specific B1/B2 bounds as opposed to the defaults using sievedepth,factor worth in prime95.

We could post suggested bounds in the reservation thread (prime95 --> suggested bounds).

vjs
08-23-2005, 05:39 PM
Humm,

Looks like Garo (not sure) already made one of these in perl.

#! /usr/bin/perl

use strict;
use warnings;

my $kval;
my $current_n;
my $count;
my @tests;

if ($#ARGV != 3) {
print("Usage: make_worktodo.pl <n_low> <n_high> <B1> <B2>\n");
print("$#ARGV\n");
exit(-1);
}

my $n_low = $ARGV[0];
my $n_high = $ARGV[1];
my $b1 = $ARGV[2];
my $b2 = $ARGV[3];

open(DATFILE, "<sob.dat") or die "Couldn't open dat file\n";

# Remove the first 3 lines
<DATFILE>;
<DATFILE>;
<DATFILE>;

my $line;
while ($line = <DATFILE> ) {
chomp $line;
if ($line =~ /^k=(\d+)/) {
$kval=$1;
$current_n = <DATFILE>;
} else {
$line =~ m/\+(\d+)/;
$current_n += $1;
}
if (($current_n < $n_high) and ($current_n >= $n_low)){
push @tests,{ 'k' => $kval, 'n' => $current_n };
$count++;
}
}
close(DATFILE);

print "$count numbers with $n_low <= n < $n_high\n";
my $removed = 0;
my $factor_k;
my $factor_n;
my $test;

print "Searching for known factors in results.txt...\n";
open(RESULTSFILE,"<results.txt") or die "Failed to open factor file!\n";
<RESULTSFILE>;
while ($line = <RESULTSFILE> ) {
next unless $line =~ m/^\d+\s+(\d+)\s+(\d+)/;
$factor_k = $1;
$factor_n = $2;

next if (($factor_n >= $n_high) or ($factor_n < $n_low));

for(my $i = 0; $i < $count; $i++) {
next unless (defined($tests[$i]));
if (($tests[$i]{'k'} == $factor_k) and ($tests[$i]{'n'} == $factor_n)) {
print "Removed $factor_k * 2^ $factor_n +1";
delete $tests[$i];
$count--;
$removed++;
$removed++;
}
}
}
close(RESULTSFILE);
print "Removed $removed numbers using the factor file\n";

print "$count numbers with $n_low <= n < $n_high\n";
@tests = sort { $$a{'n'} <=> $$b{'n'}; } grep { defined } @tests;

open(WORKFILE,'>>worktodo.ini');
foreach $test (@tests) {
print WORKFILE "Pminus1=$$test{'k'},2,$$test{'n'},1,$b1,$b2\n";
}
close(WORKFILE);

If anyone want's to make an exe for windows etc I could add it to a sticky.

garo
08-23-2005, 06:53 PM
I just modified MikeH's perl. It was a very small modification. I changed Pfactor to Pminus1 and renamed factor_depth and factor_value to b1 and b2 (not strictly necessary).

Joe O
08-23-2005, 10:35 PM
Originally posted by garo
I just modified MikeH's perl. It was a very small modification. I changed Pfactor to Pminus1 and renamed factor_depth and factor_value to b1 and b2 (not strictly necessary).

Does it work? According to the readme.txt file:

ou can also edit
the worktodo.ini file directly. For example:
Pminus1=751001,1000000,0,0,0
The first value is the exponent. The second value is bound #1. The
third value is bound #2. The fourth value is 0 for 2^N-1 factoring,
1 for 2^N+1 factoring. The fifth value is no longer used.

There is no place to specify the k.

garo
08-24-2005, 07:47 AM
Yes it does work. Try it!! The first few lines of my current wtd look like this:

Pminus1=21181,2,9820268,1,20000,240000
Pminus1=22699,2,9820270,1,20000,240000
Pminus1=33661,2,9820296,1,20000,240000
Pminus1=24737,2,9820303,1,20000,240000

I've done about 70 tests already.

vjs
08-24-2005, 12:36 PM
Well I know the worktodo line structure is valid I've been using it for some time now. The only question is the exe for windoze, I don't have perl installed.

Joe O
08-24-2005, 03:36 PM
Originally posted by vjs
Well I know the worktodo line structure is valid I've been using it for some time now. The only question is the exe for windoze, I don't have perl installed.

How did you find out about it? I've never seen this form documented before.

Joe O
08-24-2005, 04:00 PM
OK someone please try this program and BAT file.

Version 0.0 produces 600000.0 instead of 600000 This will be fixed real soon now. Please just edit it for now.

OK replaced with Version 0.1<G> The last parameter is now fixed.

One change from MikeH's program. It looks for an optional file called recent.txt to eliminate recently found results from the sob.dat. The problem with using the file name results.txt is that it conflicted with the results.txt of Prime95 I don't want to tell you how many times I downloaded results.txt over Prime95's results.txt and/or had Prime95 append to the SoB results.txt before I put them in separate directories. But then I had to move the worktodo.ini results etc. You can still mess up and download results.txt over Prime95's results.txt, but if you are careful and rename it to recent.txt when you download it, this can now coexist in the same folder. I'm going to request MikeH to provide a recent.txt file that will have only the recent results, about 30 days worth (or 60 or 90 but not more). This will carry us over from dat to dat. Yes I know he now produces a daily dat, but only for 2M-20M. And the daily dat is still bigger than the recent.txt would be, so this will cut down on his bandwith usage.

vjs
08-24-2005, 04:12 PM
Gosh Joe,

If it were someone else I'd say that Joe told me about it...

I think it might have been documented in one of the whatsnew.txt help.txt files for a version somewhere. It's was obviously carried over.

garo
08-31-2005, 09:22 AM
You can always add the line

results.txt=factor.txt

to prime.ini to avoid the overwriting problem. This way Prime95 will write all the results stuff into factor.txt

BTW, Pminus1 has been a very old valid worktodo format. it's been in existence at least since v22, i.e. 3 years ago. When George coded Prime95 to handle numbers of the form k*2^n+c, both Pfactor and Pminus1 forms became valid for this extended set of numbers.

vjs
08-31-2005, 12:13 PM
Garo do you know other fuction directly related to SoB,

I know the ecm=

Is there a Pplus1=

I tried various permutations didn't work for me.

garo
08-31-2005, 01:43 PM
From the whatsnew.txt:

New features in Version 24.6 of prime95.exe


Athlon users should see a 20% to 30% speed increase.
Pentium, Pentium II, Pentium III users should see dramatically WORSE performance. Run version 23 instead.
P-1 and ECM now support numbers of the form k*b^n+c. This cannot be done from the menus. Add these entries to worktodo.ini:
Pminus1=k,b,n,c,B1,B2

ECM2=k,b,n,c,B1,B2,curves_to_do[,specific_sigma]


Use ECM2=..... and not ECM=.....

And P+1 is not supported. I don't think Prime95 implements P+1 for any numbers, not even Mersenne numbers. P+1 is of questionable effectiveness and if I recall correctly, it is better to do an ECM curve rather than a P+1 test for numbers of a particular size. I do not recall exactly what size, you can PM Alex Kruppa at the mersenne forums for an answer.

I believe GMP-ECM does a good job of doing P+1.

vjs
08-31-2005, 02:13 PM
Thanks Garo...

Yes I've read somewhere that P+1 isn't very good for our types of numbers, can't even comment as to why. I think it just doesn't fit some form.

P+1 may be worth doing if your really trying to factor something but not just trying to find any factor. Wlipp has stated that he generally runs 3 P+1's at 3 levels higher than the ECM bounds.

Looks like it's time for another Prime95 update for me :D

we will see what happens.

Garo where did you find 24.6 I can only find 24.14 or 23.6 ???

garo
09-01-2005, 06:14 AM
http://mersenne.org/gimps/

Mystwalker
09-05-2005, 04:10 AM
I'd nevertheless take the newest version.
Some older had slight bugs in it. In addition, somewhere around 24.11, George Woltman redistributed code paths to CPUs, so to say. Thus, chances are that the newer version is a few % faster.

MikeH
09-09-2005, 03:27 PM
For info, notification of latest versions of Prime95 can be found at

http://www.mersenneforum.org/showthread.php?t=2

MikeH
09-28-2005, 05:37 PM
I've updated http://www.aooq73.dsl.pipex.com/utils/makewtd.zip

It now allows just about all of the useful P-1 and ECM combinations. Also a lot more flexibility with k selection.

As always source is included. Suggestions always welcome.

EDIT: For anyone who accesses the internet via a caching proxy (like me some of the time), if you use the link above you may get an old version. The correct version will be obtained at www.aooq73.dsl.pipex.com/utils/makewtd_2005_09_28.zip (http://www.aooq73.dsl.pipex.com/utils/makewtd_2005_09_28.zip)

MikeH
10-19-2005, 05:07 PM
Another update of http://www.aooq73.dsl.pipex.com/utils/Makewtd.zip is available. Also as http://www.aooq73.dsl.pipex.com/utils/Makewtd_2005_10_19.zip

This will automatically exclude 4847, and also adds support for k exclusion to compliment k inclusion.

Enjoy.;)