Chernick's Carmichael numbers: Difference between revisions
m
→{{header|Phix}}: improved output
m (→{{header|Phix}}: improved output) |
|||
Line 906:
function chernick_carmichael_number(integer n)
integer
while not is_chernick_carmichael(n,
return {chernick_carmichael_factors(n,
end function
for n=3 to 9 do
{sequence f, integer m} = chernick_carmichael_number(n)
mpz_set_si(p,1)
for i=1 to length(f) do f[i] = sprintf("%d",f[i]) end for▼
mpz_mul_d(p,p,f[i])
end for
printf(1,"U(%d,%d): %s = %s\n",{n,m,mpz_get_str(p),join(f," * ")})
end for</lang>
{{out}}
<pre style="font-size: 10px">
</pre>
Pleasingly fast, note however that a(10) remains well out of reach / would probably need a complete rewrite.
|