primality testing using a modified Fermat test

37 Views Asked by At

Is the following valid:

$$n>1 \textrm{ is prime} \longleftrightarrow\forall a\in \{1,...,n-1\}\:a^{n-1}\equiv1\mod{n}$$ proof: If n is prime use FLT. If n is not prime then n has a prime factor p

notice we bypass the carmichael difficulty. But p=? you try with various a=(product of) primes

1

There are 1 best solutions below

0
On

$\forall a\in \{1,...,n-1\}\:a^{n-1}\equiv1\bmod{n}$ implies $\forall a\in \{1,...,n-1\}\:\gcd(a,n)=1$ and this is equivalent to $n$ is prime.