Jump to content

AKS test for primes: Difference between revisions

m
Fixed small bug in primerow (still gave correct results, but didn't check the middle element)
(LFE version)
m (Fixed small bug in primerow (still gave correct results, but didn't check the middle element))
Line 3,692:
 
primerow([], _).
primerow([A,A|_], _N) :- A mod N == 0. % end when we've seen half the list.
primerow([A|As], N) :- (A mod N == 0; A == 1), primerow(As, N).
 
357

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.