AKS test for primes: Difference between revisions

m
→‎{{header|Phix}}: remove clash with is_prime()
m (→‎{{header|Phix}}: remove clash with is_prime())
Line 2,806:
 
=={{header|Phix}}==
<lang Phix>-- demo/rosetta/AKSprimes.exw
-- Does not work for primes above 53, which is actually beyond the original task anyway.
-- Translated from the C version, just about everything is (working) out-by-1, what fun.
Line 2,820:
end procedure
 
function is_primeis_aks_prime(integer n)
coef(n+1); -- (I said it was out-by-1)
for i=2 to n-1 do -- (technically "to n" is more correct)
Line 2,866:
end procedure
procedure AKS_test_for_primesmain()
for n=1 to 10 do -- (0 to 9 really)
coef(n);
Line 2,878:
c[2] = 1 -- (this manages "", which is all that call did anyway...)
for n = 2 to 53 do
if is_primeis_aks_prime(n) then
printf(1," %d", n);
end if
Line 2,885:
if getc(0) then end if
end procedure
main()</lang>
 
AKS_test_for_primes()
 
</lang>
{{out}}
<pre>
7,795

edits