Anonymous user
Carmichael 3 strong pseudoprimes: Difference between revisions
m
→vertical list: changed the format of the output.
m (→optimized: changed the version name.) |
m (→vertical list: changed the format of the output.) |
||
Line 1,190:
<br>Some code optimization was done, while not necessary for the small default number ('''61'''), it was significant for larger numbers.
<lang rexx>/*REXX program calculates Carmichael 3─strong pseudoprimes (up to and including N). */
numeric digits
parse arg N .; if N=='' then N=61 /*allow user to specify for the search.*/
tell= N>0; N=abs(N) /*N>0? Then display Carmichael numbers*/
Line 1,213:
$=0 /*display a list of some Carmichael #s.*/
do j=bot to top by 2 while tell; if @.j==0 then iterate; $=1
say '
end /*j*/
if $ then say /*show a blank line for beautification.*/
end /*p*/
say
say
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Line 1,232:
'''output''' when using the default input:
<pre style="height:65ex">
▲──────── a Carmichael number: 7 ∙ 31 ∙ 73
▲──────── a Carmichael number: 7 ∙ 73 ∙ 103
▲──────── a Carmichael number: 13 ∙ 97 ∙ 421
▲──────── a Carmichael number: 19 ∙ 199 ∙ 271
▲──────── a Carmichael number: 31 ∙ 271 ∙ 601
▲──────── a Carmichael number: 31 ∙ 991 ∙ 15361
▲──────── a Carmichael number: 43 ∙ 433 ∙ 643
▲──────── a Carmichael number: 43 ∙ 547 ∙ 673
▲──────── a Carmichael number: 43 ∙ 631 ∙ 1597
▲──────── a Carmichael number: 43 ∙ 3361 ∙ 3907
▲──────── a Carmichael number: 53 ∙ 157 ∙ 521
▲──────── a Carmichael number: 61 ∙ 181 ∙ 1381
▲──────── a Carmichael number: 61 ∙ 241 ∙ 421
▲──────── a Carmichael number: 61 ∙ 271 ∙ 571
▲──────── a Carmichael number: 61 ∙ 277 ∙ 2113
▲──────── a Carmichael number: 61 ∙ 421 ∙ 12841
▲──────── a Carmichael number: 61 ∙ 541 ∙ 3001
▲──────── a Carmichael number: 61 ∙ 661 ∙ 2521
▲──────── a Carmichael number: 61 ∙ 1301 ∙ 19841
▲──────── a Carmichael number: 61 ∙ 3361 ∙ 4021
──────── 69 Carmichael numbers found.
</pre>
'''output''' when using the input of: <tt> -1000 </tt>
|