AKS test for primes: Difference between revisions

m
Line 2,542:
 
iterator polyExpansion(n: int): tuple[c, e: int] =
## Yield the coeeficientscoefficients and the exponents of the expansion of (x - 1)ⁿ.
var e = n
for c in coeffs(n):
Line 2,549:
 
proc termString(c, e: int): string =
## Return the string for the termeterm c * e^n.
if e == 0:
result.addInt(c)
Line 2,569:
 
proc isPrime(n: int): bool =
## Check if thea anumbernumber is prime using the polynome expansion.
result = true
for (c, e) in polyExpansion(n):
Anonymous user