## Primemine2

Expand Messages
• My aim with primemine2 (pm2) was to reach primes of 20 digits using the same basic principles of the first prime mine while maintaining a good primes found /
Message 1 of 1 , Apr 2, 2011
My aim with primemine2 (pm2) was to reach primes of 20 digits using the same basic principles
of the first prime mine while maintaining a good primes found / per second ratio in excess of 1000,
as well as greatly shortening the waiting period for results ,all within the constraints of using 80's
Pascal software and Pentium3 hardware. This technique of processing the large batches of primes
that are likely to exist within any narrow corridor of values of certain binary quadratic forms
beginning at (x,1) and ending at (1,y) has the drawback of needing to traverse that entire interval
to get any valid result at all, so I am fortunate to have found a way to cut the time for processing
by a factor of 35 in pm2 over pm1. Pm1 utilized 40 of each 100 rows (y values) of A = 5*x*x + 5*x*y + y*y,
while pm2 employs just 18 of each 500 rows of A = 25*x*x + 25*x*y + y*y. I am sure
that there exist ways to vastly further cut the number of rows that need be examined to get
valid results as well as more efficient numeric processing methods.This will make for some tricky
programming difficulties because while no psuedoprimes can exist in this type of search algorithm,
unwanted values (composites) have a way of creeping in from programming mistakes. Hopefully
pm2 is robust enough and error-free in this regard. Pm2 also gives 1416 times as many choices of
sequences to search for primes as did pm1.

Aldrich Stevens

{pascal code}
{\$N+}{E+}
Program PRIMEMINE2 (input, output);
uses wincrt;
type
numptr = ^number;
number = record
next : array[0..64000] of shortint;
end;
frame = array[0..999] of numptr;
var
z,h2,h4,h18,h13,qq1,qq2 : extended;
bo1 : boolean;
fr : frame;
ct,w : longint;
ch : char;
a,g,m : longint;

Procedure bigsieve;
var i : integer;
a : longint;
begin
for i := 0 to 999 do
new(fr[i]);

for i := 0 to 999 do
for a := 0 to 64000 do
begin
fr[i]^.next[a] := 0;
end;
end;

Procedure gcd1;
var
c,hqf1,hqf2,r,s,t : extended;
begin
bo1 := false;
r := 2;
hqf1 := h2;
hqf2 := h4;

If hqf1 <> hqf2 then
begin
While r > 1 do {}
begin
c := hqf1/hqf2;
s := int(c/1e9)*1e9;
t := c - s;
s := s + int(t);
r := hqf1 - s*hqf2;
hqf1 := hqf2; hqf2 := r;
end;
end;
if r = 0 then
begin
{writeln(' gcd ',hqf1);{}
bo1 := true;
end;
end;

procedure sieveX;
var
g1,g2,g11,s: longint;
begin
If H4 -INT(H4/1000)*1000 = 111 then
begin
gcd1;
if not bo1 then
begin
g11 := trunc((h4-H18 -111)/1000);
g1 := g11 mod 64000;
g2 := g11 div 64000;

if (fr[g2]^.next[g1]) = 0 then
begin
fr[g2]^.next[g1] := fr[g2]^.next[g1] + 1;
W := W + 1;
end
else if (fr[g2]^.next[g1]) = 1 then
begin
fr[g2]^.next[g1] := fr[g2]^.next[g1] + 1;
W := W -1;
end;
end;
end ;
end;
procedure printx;
var
g,g1,g2,i,S : longint;
z : extended;
procedure PPP;
var I : LONGINT;

begin
g := g + 1;
z := (g2*64000 +g1);
z := z*1000 + S + h18; {}

if int(z/3) - z/3 = 0 then z := z/3;
if int(z/7) - z/7 = 0 then z := z/7;{}

writeln(' Prime # ',G,' of ',w);
writeln(TRUNC(z/1e11),trunc((z -int(z/1e11)*1e11)/1e2):9,trunc(z-INT(z/100)*100):2);
for i := 3 to 30000 do
if odd(i) then
if int(z/i) - z/i = 0 then
begin
writeln('ERROR , factor = ',i);;
end;
end;

begin
writeln('SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS');
g := 0;
for g2 := 0 to 999 do
for g1 := 0 to 64000 do
begin
if (fr[g2]^.next[g1]) MOD 3 = 1 then
begin
S := 111;
PPP;
end;
end;
writeln(' end ');
end;

procedure by500;
var i : integer;
XX1,xx2,xx3 : EXTENDED;
begin

writeln('The binary quadratic equation that is the basis for this Prime Mine');
writeln('is A = 25*x*x + 25*y*y + y*y with y = M*1e5 + 1533, 1 < M < 8501.');
writeln;
writeln('Here are the stats generated in test runs done on a Dell 866 Pentium3');
writeln('machine for a few sample values of M:');
writeln;
writeln('M, approx.size of primes,wait time(in sec),primes per sec');
writeln('...2.........1e12.............2................2000');
writeln('..20.........1e14...........1.7................1690');
writeln('..65.........1e15.............6................1520');
writeln('.200........ 1e16............19................1380');
writeln('.634.........1e17............62................1260');
writeln('2000.........1e18...........200................1160');
writeln('6326.........1e19...........640................1090');
writeln('8500(max)...1.8e19..........870................1060');
writeln;
writeln(' please enter an integer M such that 1 < M < 8501 ');
writeln;

repeat
h13 := m*1e5 + 1533{};
until ( m > 1) and (m < 8501);

h2 := 6;
h4 := 25*h13*h13 + 25*h13*h2 + h2*h2;
qq2 := h4 -1;
h13 := h13 -1; h2 := 6;
h4 := 25*h13*h13 + 25*h13*h2 + h2*h2;
qq1 := h4 -1;
H18 := int(qq1/1000)*1000 ;
W := 0;
xx3 := int(5*h13/1000)*1000+606;
h13 := 6; h2 := xx3;
h4 := 25*h13*h13 + 25*h13*h2 + h2*h2;
xx2 := h4;
h13 := 5;
h4 := 25*h13*h13 + 25*h13*h2 + h2*h2;
xx1 := h4;

for i := 1 to 18 do
BEGIN
case i of
1: begin
h13 := 5; h2 := xx3;
end;
2: begin
h13 := 5; h2 := xx3 -12 ;
end;
3: begin
h13 := 7; h2 := xx3 -25 ;
end;
4: begin
h13 := 11; h2 := xx3 -75;
end;
5: begin
h13 := 11; h2 := xx3 -87;
end;
6: begin
h13 := 15; h2 := xx3 -125;
end;
7: begin
h13 := 15; h2 := xx3 -137;
end;
8: begin
h13 := 19; h2 := xx3 -187;
end;
9: begin
h13 := 21; h2 := xx3 -200;
end;
10: begin
h13 := 21; h2 := xx3 -212;
end;
11: begin
h13 := 27; h2 := xx3 -275;
end;
12: begin
h13 := 29; h2 := xx3 -312;
end;
13: begin
h13 := 31; h2 := xx3 -325;
end;
14: begin
h13 := 31; h2 := xx3 -337;
end;
15: begin
h13 := 35; h2 := xx3 -375;
end;
16: begin
h13 := 35; h2 := xx3 -387;
end;
17: begin
h13 := 37; h2 := xx3 -400;
end;
18: begin
h13 := 39; h2 := xx3 -437;
end;
end;

h4 := 25*h13*h13 + 25*h13*h2 + h2*h2;
a := 41;
ct := 1;
if h4 < qq2 then
if h4 > qq1 then
sievex;{}

repeat
ct := ct + 1;
h13 := h13 + a ;;
h2 := h2 -500;
h4 := 25*h13*h13 + 25*h13*h2 + h2*h2;

if h4 > qq2 then
begin
h13 := h13 - 1 ;;
h4 := 25*h13*h13 + 25*h13*h2 + h2*h2;
end
else if h4 < qq1 then
begin
h13 := h13 + 1 ;;
h4 := 25*h13*h13 + 25*h13*h2 + h2*h2;
if h4 < qq1 then
begin
h13 := h13 + 1 ;;
h4 := 25*h13*h13 + 25*h13*h2 + h2*h2;
a := a + 1;
end;
end;

if h4 < qq2 then
if h4 > qq1 then
sieveX;
until h2 < 500;{};
END;
printx;
end;

BEGIN {TOP}

bigsieve;;
by500;

END.
Your message has been successfully submitted and would be delivered to recipients shortly.