Exercise · ZW-FERMAT-PRIMALITY-TEST-010 · ★★★ Advanced

Show with the base-2 test whether 341 is composite, or explain why it cannot detect it and which base reveals it.

Choose one option.

Show answer
  • D. Base 2 does not detect it, but base 3 gives \( 3^{340} \equiv 56 \pmod{341} \), which proves it is composite

Explanation

With base 2 the congruence holds (341 = 11·31 is a base-2 pseudoprime), but with base 3 the remainder is 56 rather than 1, which exposes the 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-009