Latest binaries can be found at:

  http://www.geocities.com/g_w_reynolds/sr2sieve/

Source is at:

  http://www.geocities.com/g_w_reynolds/sr5sieve/

To report bugs, email me (Geoff): g_w_reynolds at yahoo.co.nz.


SR2SIEVE
========

Sr2sieve is Srsieve specialised for sequences k*b^n+/-1.

Command line options:

 -s --sierpinski       Sieve sequences k*2^n+1 in dat format file 'SoB.dat'
 -r --riesel           Sieve sequences k*2^n-1 in dat format file 'riesel.dat'
 -i --input FILE       Read sieve from FILE instead of `sr2data.txt'.
                        Instead of `SoB.dat',`riesel.dat' when used with -s,-r.
 -p --pmin P0          Sieve for factors p in the range P0 <= p <= P1 instead
 -P --pmax P1           of reading ranges from work file `sr2work.txt'.
 -u --uid STRING       Append -STRING to base of per-process file names.
 -c --cache            Save Legendre symbol tables to `sr2cache.bin'.
 -C --cache-file FILE  Load (or save) Legendre symbol tables from (or to) FILE.
    --sse2             Use SSE2 vector optimisations.
    --no-sse2          Don't use SSE2 vector optimisations.
 -l --L1-cache SIZE    Assume L1 data cache is SIZE Kb.
 -L --L2-cache SIZE    Assume L2 cache is SIZE Kb.
 -H --hashtable SIZE   Force use of a SIZE Kb hashtable.
 -Q --subseq Q         Force sieving k*b^n+c as subsequences (k*b^d)*(b^Q)^m+c.
 -D --duplicates       Report factors that don't eliminate any composite.
 -z --idle             Run at idle priority. (Default)
 -Z --no-idle          Don't adjust priority.
 -v --verbose          Print some extra messages.
 -h --help             Print this help.

If -p and -P are not provided, then sr2sieve will read the sieve range from
a file called sr2work.txt in the current directory. Each line of this file
should contain a pair of integers A,B seperated by a comma, space, or dash.
A and B are in billions, the actual sieving range is A*10^9 to B*10^9.
E.g. invoking `sr2sieve' with the line `1000,1001' in sr2work.txt is
equivalent to invoking `sr2sieve -p 1000e9 -P 1001e9'.

For given sequences k*b^n+/-1 and prime factor p, the following limits apply:

  1 < k < 2^32.
  1 < b < 2^32.
  core(k)*core(b) < 2^31. (core(k) is the squarefree part of k).
  0 < n < 2^32.
  k,b < p < 2^52. (or 2^62 for x86 builds, or 2^63 for ppc64).

Only factors larger than k and b will be found, so the sieve must be started
and sieved until p >= max(k,b) with another program (NewPGen, Srsieve).

If core(k)*core(b) is large, then a lot of initialization time and memory
may be required. To avoid this the -c or -C switches can be used to write
initialization data to file, which will be used to speed up initialization
the next time the sieve is started.

If neither -s nor -r switches are used then the input file must be in ABCD
format. The srfile utility can be used to convert files from NewPGen format
to ABCD format and vice versa, and can also be used to remove found factors
from the ABCD file (sr2sieve doesn't update the input file itself). Srfile
is included in srsieve at http://www.geocities.com/g_w_reynolds/srsieve/

If sr2sieve is interrupted (e.g. pressing ctrl-c) or terminated nicely
(e.g. by running `kill `pidof sr2sieve') then the output file will be
updated before it finishes. Beware that this doesn't happen in Windows when
closing the sr2sieve window by clicking the close button, so press ctrl-c.

When comparing the output with Proth sieve, be aware that sr2sieve only
reports the first factor it finds for a number and all subsequent factors
for the same number are considered duplicates. Proth sieve however doesn't
count these as duplicates, and so fact.txt may contain some extra factors.
Use 'sort -k3,3 fact.txt | uniq -f2 -d' to find them.

If no command line arguments are given but `sr2sieve-command-line.txt'
exists in the current directory, then the command line will be as if the
first line of this file had been used to invoke sr2sieve. This may be useful
on some GUI machines where the command shell and batch files have been
disabled for security reasons.

To compile sr2sieve from the sr5sieve source, just change the definition of
BASE in sr5sieve.h from 5 to 0, run make as usual (see INSTALL), and rename
the executable from sr5sieve to sr2sieve.
