Ormiston pairs: Difference between revisions
m
→{{header|Free Pascal}}: false syntax highlighter, minor optimization
(→{{header|jq}}: prepend Free Pascal version) |
m (→{{header|Free Pascal}}: false syntax highlighter, minor optimization) |
||
Line 346:
==={{header|Free Pascal}}===
update the digits by adding difference.
<syntaxhighlight lang=
program Ormiston;
{$IFDEF FPC}{$MODE DELPHI} {$OPTIMIZATION ON,ALL}{$ENDIF}
Line 466:
type
td10_UsedDgts = array[0..11] of byte;
td10_UsedDgts2 = array[0..2] of Uint32;
tpd10_UsedDgts2 = ^td10_UsedDgts2;
//size of 32 byte. two XMMx - 16 byte copies p1:=p2
tDigits10 = record
d10_UsedDgts :
d10_dgts :array[0..15] of byte;
d10_maxIdx : Uint32;
Line 523 ⟶ 527:
end;
var
i,r,m10,dgt: Uint32;
begin
with
begin
i := 0;
Line 557 ⟶ 561:
end;
end;
end;
function CheckOrmiston(d1,d2:tpd10_UsedDgts2):boolean;inline;
//check 4 byte at once, not byte by byte
begin
result := (d1^[0]=d2^[0]) AND (d1^[1]=d2^[1]) AND (d1^[2]=d2^[2]);
end;
Line 564 ⟶ 574:
p1,p2 :tDigits10;
pr,pr_before,
Begin
T0 := now;
Line 580 ⟶ 590:
repeat
inc(pr);
until pSieve[pr];
if pr > limit then
BREAK;
▲ if p2.d10_UsedDgts[i] <> p1.d10_UsedDgts[i] then
begin
inc(cnt);
IF cnt <= 30 then
OutIn(cnt,pr_before,pr);
end;
p1 := p2;
Line 618 ⟶ 621:
34,901 Ormiston pairs before 100,000,000
Real time: 0.
@home 1E10
|