Anonymous user
Carmichael 3 strong pseudoprimes: Difference between revisions
Carmichael 3 strong pseudoprimes (view source)
Revision as of 07:14, 27 September 2014
, 9 years ago→{{header|REXX}}: removed the need for finding the minimum.
(→{{header|REXX}}: changed the inner DO loop to be faster, added shortcut calculations, used a flag to suppress blank lines, increased initial prime memoization list, removed 1st version (unsorted list).) |
m (→{{header|REXX}}: removed the need for finding the minimum.) |
||
Line 801:
/*[↓] prime # memoization array.*/
do p=3 to N by 2; if \isPrime(p) then iterate /*Not prime? Skip.*/
pm=p-1; nps=-p*p; @.=0;
/*[↑] Carmichael
do h3=2 to pm; g=h3+p /*find Carmichael #s for this P. */
gpm=g*pm; npsh3=((nps//h3)+h3)//h3 /*shortcut stuff. */
Line 812:
if \isPrime(r) then iterate
carms=carms+1 /*bump the Carmichael # counter. */
end /*d*/
end /*h3*/
$=0 /*display a list of some Carm #s.*/
do j=
say '──────── a Carmichael number: ' p times j times @.j
end /*j*/
if $ then say /*show
end /*p*/
|