Extra primes: Difference between revisions
m
→{{header|Free Pascal}}: now with crossing 10th order of magnitude like in Raku
m (→{{header|Free Pascal}}: Free Pascal as sub category of Pascal) |
m (→{{header|Free Pascal}}: now with crossing 10th order of magnitude like in Raku) |
||
Line 1,990:
=={{header|Pascal}}==
==={{header|Free Pascal}}===
using simple circular buffer for last n solutions.With crossing 10th order of magnitude like in Raku.
<syntaxhighlight lang="pascal">program SpecialPrimes;
// modified smarandache
{$IFDEF FPC}{$MODE DELPHI}{$OPTIMIZATION ON,ALL}{$ENDIF}
Line 2,001:
var
Last64 : array[0..63] of Uint64;
cnt,Limit : NativeUint;
Line 2,010:
idx: Int32;
begin
idx := LastIdx-i
idx += High(Last64)+1;
For i := i downto 1 do
begin
Line 2,081:
end
else
IF n >
Begin
OutLast(7);
Line 2,128:
inc(LastIdx);
OutLast(7);
writeln('count: ',cnt);
end.</syntaxhighlight>
{{out|@TIO.RUN}}
Line 2,135 ⟶ 2,136:
2777, 3253, 3257, 3323, 3527, 3727, 5233, 5237, 5273, 5323,
5527, 7237, 7253, 7523, 7723, 7727,
count: 107308
Real time: 46.241 s CPU share: 99.38 %
@home: Real time: 8.615 s maybe much faster div ( Ryzen 5600G 4.4 Ghz vs Xeon 2.3 Ghz)
|