Carmichael 3 strong pseudoprimes: Difference between revisions

m (→‎{{header|Ring}}: Remove vanity tags)
Line 1,585:
67 × 331 × 7393 == 163954561
67 × 331 × 463 == 10267951</pre>
 
=={{header|Phix}}==
Uses is_prime() from [[Extensible_prime_generator#Phix|Extensible_prime_generator]]
<lang Phix>integer count = 0
for p1=1 to 61 do
if is_prime(p1) then
for h3=1 to p1 do
atom h3p1 = h3 + p1
for d=1 to h3p1-1 do
if mod(h3p1*(p1-1),d)=0
and mod(-(p1*p1),h3) = mod(d,h3) then
atom p2 := 1 + floor(((p1-1)*h3p1)/d),
p3 := 1 +floor(p1*p2/h3)
if is_prime(p2)
and is_prime(p3)
and mod(p2*p3,p1-1)=1 then
if count<5 or count>55 then
printf(1,"%d * %d * %d = %d\n",{p1,p2,p3,p1*p2*p3})
elsif count=35 then puts(1,"...\n") end if
count += 1
end if
end if
end for
end for
end if
end for
printf(1,"%d Carmichael numbers found\n",count)</lang>
{{out}}
<pre>
3 * 11 * 17 = 561
5 * 29 * 73 = 10585
5 * 17 * 29 = 2465
5 * 13 * 17 = 1105
7 * 19 * 67 = 8911
...
61 * 271 * 571 = 9439201
61 * 241 * 421 = 6189121
61 * 3361 * 4021 = 824389441
69 Carmichael numbers found
</pre>
 
=={{header|PicoLisp}}==
7,796

edits