Exercise · ZW-FERMAT-PRIMALITY-TEST-009 · ★★☆ Intermediate

For n = 21 and a = 2, what result does the Fermat test give?

Choose one option.

Show answer
  • A. It concludes that 21 is composite, since \( 2^{20} \equiv 4 \pmod{21} \)

Explanation

Computing \( 2^{20} \bmod 21 \) gives 4 (since \( 2^6 \equiv 1 \pmod{21} \) and \( 2^{20} = 2^{18}\cdot 2^2 \equiv 4 \)), which is not 1; the test declares 21 composite.

Study Elementary number theory in ZWMath →

Review the concept: Fermat primality test

The Fermat primality test is a probabilistic criterion for an integer \(n>1\): it declares \(n\) composite if, for some base \(a\) coprime to \(n\), the power \(a^{n-1}\) is not congruent to 1 modulo \(n\).

\[a^{n-1} \equiv 1 \pmod{n}\]

More practice problems: fermat primality test

← ZW-FERMAT-PRIMALITY-TEST-008 ZW-FERMAT-PRIMALITY-TEST-010 →