Wieferich Prime Checker

Check whether p is prime and 2^(p−1)≡1 (mod p²) with exact modular arithmetic; primality testing is limited to p≤10¹².

Description

A base-two Wieferich prime is a prime for which Fermat’s congruence also holds modulo p².

A base-two Wieferich prime is a prime for which Fermat’s congruence also holds modulo p². This exceptional arithmetic property is distinct from primality itself.1

The tool returns isWieferich. The indexing and output conventions below determine how to read these values.

When to use Wieferich Prime Checker

Use this for the following task: Check whether p is prime and 2^(p−1)≡1 (mod p²) with exact modular arithmetic; primality testing is limited to p≤10¹². Use the input and output conventions below to reproduce the intended mathematical quantity.

How to use Wieferich Prime Checker and understand its results

  1. Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
  2. Enter p according to the field table, then run the tool.
  3. Read isWieferich. A true flag means the candidate meets the stated property; false means it does not.
  4. If the flag is false, review the candidate and definition. A well-formed nonmember is different from a rejected input.
Input fieldMeaningValue type and boundsRequirement
pCandidate prime (primality resource limit 10^12)integer; minimum 1; maximum 1000000000000Required

Reject values outside the declared integer bounds, test primality by deterministic trial division, and use exact modular exponentiation for the square-modulus condition.

prime(p) AND 2^(p−1) mod p² = 1

The symbols and boundary conditions refer to the supplied fields and the implementation described above.

Output fieldMeaningValue type
isWieferichWhether p is a base-two Wieferich primeboolean
json
{
  "input": {
    "p": 1093
  },
  "output": {
    "isWieferich": true
  }
}

Limitations and assumptions

The input limit is 10¹² for bounded primality work. This checks base two only, and a composite number returns false.

Use the declared integer bounds and string formats. Large exact outputs remain decimal strings; numerical approximations use ordinary floating-point arithmetic. A rejected input is different from a valid zero count or false membership flag.

Alternative or Complementary methods

Choose Wilson Prime Checker when you need its operation: Check whether p is prime and (p−1)!+1 is divisible by p², using modular products with a 100,000-factor resource limit. Choose Base-Two Fermat Pseudoprime Checker for the complementary operation: Check whether n is composite and 2^(n−1)≡1 (mod n), using exact modular arithmetic and trial primality testing limited to n≤10¹².

Background reference: OEIS A001220.

References

  1. OEIS A001220 — OEIS Foundation

Similar or alternative tools

  • Wilson Prime Checker

    Check whether p is prime and (p−1)!+1 is divisible by p², using modular products with a 100,000-factor resource limit.

  • Base-Two Fermat Pseudoprime Checker

    Check whether n is composite and 2^(n−1)≡1 (mod n), using exact modular arithmetic and trial primality testing limited to n≤10¹².

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies