Jump to content

Ruth-Aaron numbers: Difference between revisions

m
→‎{{header|Free Pascal}}: added timings for sub tasks
m (→‎{{header|Free Pascal}}: added timings for sub tasks)
Line 1,063:
==={{header|Free Pascal}}===
all depends on fast prime decomposition.
<syntaxhighlight lang="pascal">program RuthAaronNumb;
program RuthAaronNumb;
// gets factors of consecutive integers fast
// limited to 1.2e11
Line 1,458 ⟶ 1,459:
until false
end;
var
 
T1,T0 : Int64;
Begin
T0 := GetTickCount64;
InitSmallPrimes;
Get_RA_Prime(30,false);
Get_RA_Prime(30,true);
writeln;('used time: ',GettickCount64-T0,' ms');
writeln;
 
writeln('First Ruth-Aaron triple (factors) :');
T0 := GetTickCount64;
writeln(findfirstTripplesFactor(true):10,' in ',GettickCount64-T0,' ms');
writeln;
writeln('First Ruth-Aaron triple (divisors):');
T0 := GetTickCount64;
writeln(findfirstTripplesFactor(false):10);,' in ',GettickCount64-T0,' ms');
end.</syntaxhighlight>
{{out|@TIO.RUN}}
<pre>
Real time: 6.811 s CPU share: 99.35 %
First 30 Ruth-Aaron numbers (divisors ):
5 24 49 77 104 153 369 492
Line 1,483 ⟶ 1,490:
5959 6867 8280 8463 10647 12351 14587 16932
17080 18490 20450 24895 26642 26649
used time: 8 ms
 
First Ruth-Aaron triple (factors) :
417162 in 28 ms
 
First Ruth-Aaron triple (divisors):
89460294 in 6817 ms
 
</pre>
Real time: 67.811011 s CPU share: 99.3503 %</pre>
 
=={{header|Perl}}==
132

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.