Carmichael 3 strong pseudoprimes: Difference between revisions
Content added Content deleted
(Added zkl) |
(Add Perl) |
||
Line 364: | Line 364: | ||
{{out}} |
{{out}} |
||
<pre>561, 1105, 2465, 10585, 1729, 2821, 6601, 8911, 15841, 52633, 29341, 46657, 115921, 314821, 530881, 162401, 7207201, 334153, 1024651, 1615681, 3581761, 5444489, 399001, 512461, 1193221, 1857241, 5049001, 5481451, 471905281, 294409, 488881, 1461241, 8134561, 36765901, 252601, 410041, 1909001, 5148001, 7519441, 434932961, 2489462641, 1152271, 3057601, 5968873, 6868261, 11972017, 14913991, 15829633, 43331401, 67902031, 368113411, 564651361, 104569501, 902645857, 958762729, 2508013, 4335241, 17316001, 178837201, 6189121, 9439201, 15247621, 35703361, 60957361, 99036001, 101649241, 329769721, 824389441, 1574601601, 10267951, 163954561, 7991602081,</pre> |
<pre>561, 1105, 2465, 10585, 1729, 2821, 6601, 8911, 15841, 52633, 29341, 46657, 115921, 314821, 530881, 162401, 7207201, 334153, 1024651, 1615681, 3581761, 5444489, 399001, 512461, 1193221, 1857241, 5049001, 5481451, 471905281, 294409, 488881, 1461241, 8134561, 36765901, 252601, 410041, 1909001, 5148001, 7519441, 434932961, 2489462641, 1152271, 3057601, 5968873, 6868261, 11972017, 14913991, 15829633, 43331401, 67902031, 368113411, 564651361, 104569501, 902645857, 958762729, 2508013, 4335241, 17316001, 178837201, 6189121, 9439201, 15247621, 35703361, 60957361, 99036001, 101649241, 329769721, 824389441, 1574601601, 10267951, 163954561, 7991602081,</pre> |
||
=={{header|Perl}}== |
|||
{{libheader|ntheory}} |
|||
<lang perl>use ntheory qw/forprimes is_prime vecprod/; |
|||
forprimes { my $p = $_; |
|||
for my $h3 (2 .. $p-1) { |
|||
my $ph3 = $p + $h3; |
|||
for my $d (1 .. $ph3-1) { # Jameseon procedure page 6 |
|||
next if ((-$p*$p) % $h3) != ($d % $h3); |
|||
next if (($p-1)*$ph3) % $d; |
|||
my $q = 1 + ($p-1)*$ph3 / $d; # Jameson eq 7 |
|||
next unless is_prime($q); |
|||
my $r = 1 + ($p*$q-1) / $h3; # Jameson eq 6 |
|||
next unless is_prime($r); |
|||
next unless ($q*$r) % ($p-1) == 1; |
|||
printf "%2d x %5d x %5d = %s\n",$p,$q,$r,vecprod($p,$q,$r); |
|||
} |
|||
} |
|||
} 3,61;</lang> |
|||
{{out}} |
|||
<pre> |
|||
3 x 11 x 17 = 561 |
|||
5 x 29 x 73 = 10585 |
|||
5 x 17 x 29 = 2465 |
|||
5 x 13 x 17 = 1105 |
|||
... full output is 69 lines ... |
|||
61 x 661 x 2521 = 101649241 |
|||
61 x 271 x 571 = 9439201 |
|||
61 x 241 x 421 = 6189121 |
|||
61 x 3361 x 4021 = 824389441 |
|||
</pre> |
|||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |