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