Loading ...
Sorry, an error occurred while loading the content.
 

A blast from the past.

Expand Messages
  • aldrich617
    You might still have some fun with this old beauty if you happen to have a 1992 Borland Turbo Pascal compiler. Yep, I m afraid that the pentium 3 is really,
    Message 1 of 1 , May 2 9:41 PM
      You might still have some fun with this old beauty if you
      happen to have a 1992 Borland Turbo Pascal compiler. Yep,
      I'm afraid that the pentium 3 is really, totally the end
      of the road for this one. Actually I'm hoping that some of
      you intrepid hotshot backyard software tinkerers might
      take this almost-dead program and rewrite it in CCCC++++ just
      to see how the ancient stuff runs on the new-fangled devices.
      Its been supeceded - understood - but you still might profit
      from looking under the hood. Below is some executable code -
      how often to you get that? Just plug it in and go!

      {$N+}{E+}
      Program Trialdivision (input, output);
      uses wincrt;
      type
      axex = array[1..48] of longint;
      var
      axe : axex;
      hq1,hq2,hq6,hqx,hqc : extended;
      bool : boolean;
      i,j : integer;

      PROCEDURE list48;
      {the first member of all the sequences that exclude 2,3,5,7
      mod 210}

      var
      f : longint;
      i : integer;
      begin
      axe[1] := 11; axe[2] := 41; axe[3] := 71;
      axe[4] := 101; axe[5] := 131; axe[6] := 191;
      axe[7] := 31; axe[8] := 61; axe[9] := 121;
      axe[10] := 151; axe[11] := 181; axe[12] := 211;

      axe[13] := 19; axe[14] := 79; axe[15] := 109;
      axe[16] := 139; axe[17] := 169; axe[18] := 199;
      axe[19] := 29; axe[20] := 59; axe[21] := 89;
      axe[22] := 149; axe[23] := 179; axe[24] := 209;

      axe[25] := 17; axe[26] := 47; axe[27] := 107;
      axe[28] := 137; axe[29] := 167; axe[30] := 197;
      axe[31] := 37; axe[32] := 67; axe[33] := 97;
      axe[34] := 127; axe[35] := 157; axe[36] := 187;

      axe[37] := 13; axe[38] := 43; axe[39] := 73;
      axe[40] := 103; axe[41] := 163; axe[42] := 193;
      axe[43] := 23; axe[44] := 53; axe[45] := 83;
      axe[46] := 113; axe[47] := 143; axe[48] := 173;

      end;

      PROCEDURE ten30;
      {factors integers < 2 * 10^18, max runtime 630 seconds,
      change array size below to 12 to rapidly factor integers on +1 mod
      10 sequences}
      var
      i : integer;
      begin
      bool := false;
      writeln('-------------------------- ');

      LIST48;

      {ENTER A NUMBER TO BE FACTORED BELOW.
      IF IT EXCEEDS 2*10^9 ENTER IN TWO PARTS OR
      AS TWO FACTORS}

      hqx := 1986619529*1e9 ;
      hqx := hqx + 684749961;{sample}

      { hqx := 999998801 ;
      hqx := hqx*1000000271;{sample}

      writeln(trunc(hqx/1e9),trunc(hqx - trunc(hqx/1e9)*1e9):9);
      writeln('-------------------------- ');

      for i := 2 to 211 do
      if odd(i) or (i = 2) then
      Repeat
      if hqx > 2e9 then
      hqc := 1e9
      else hqc := 1;

      hq1 := hqx/i;
      hq2 := hq1 - trunc(hq1/hqc)*hqc;
      hq6 := hq2 - trunc(hq2);

      if hq6 = 0 then
      begin
      hqx := hq1;
      writeln(i:10);
      if hqx > 1 then bool := true;
      end;

      Until hq6 > 0;

      If hqx >= 211*211 then
      repeat
      for I := 1 to 48 do
      begin
      axe[i] := axe[i] + 210;
      Repeat
      if hqx > 2e9 then
      hqc := 1e9
      else hqc := 1;

      hq1 := hqx/axe[i];
      hq2 := hq1 - trunc(hq1/hqc)*hqc;

      hq6 := hq2 - trunc(hq2);

      if hq6 = 0 then
      begin
      hqx := hq1;
      writeln(axe[i]:10);
      bool := true;
      end;

      Until hq6 > 0;
      end;
      until (axe[48] > 1260211) or (axe[48] > sqrt(hqx));

      if hqx > 1.5e12 then
      repeat
      for I := 1 to 48 do
      begin
      axe[i] := axe[i] + 210;
      hqc := 1e9;
      hq1 := hqx/axe[i];
      hq2 := hq1 - trunc(hq1/hqc)*hqc;
      hq6 := hq2 - trunc(hq2);
      if hq6 = 0 then
      begin
      hqx := hq1;
      writeln(axe[i]:10);
      bool := true;
      end;
      end;
      if axe[48] mod 10000000 < 211 then write('x');
      if axe[48] mod 80000000 < 211 then write(' ');
      until (axe[48] > 1420000211) or (axe[48] > sqrt(hqx));

      writeln;
      IF HQX <= 2*1e9 then
      begin
      if bool then if hqx> 1 then writeln(trunc(hqx):9,'
      Factors');
      if not bool then if hqx> 1 then writeln(trunc(hqx):9,'
      PRIME');
      end
      else
      IF HQX > 2*1e9 then
      begin
      if bool then if hqx> 1 then writeln(trunc(hqx/1e9),
      trunc(hqx - trunc(hqx/1e9)*1e9):9,' Factors');
      if not bool then if hqx> 1 then writeln(trunc(hqx/1e9),
      trunc(hqx - trunc(hqx/1e9)*1e9):9,' PRIME');
      if not bool then if hqx> 1 then readln;
      end ;
      writeln;writeln;writeln;
      end;

      BEGIN {TOP}
      ten30;{}
      END.
    Your message has been successfully submitted and would be delivered to recipients shortly.