Fermat Number Checker

Check whether a nonnegative decimal integer has the form 2^(2^k)+1 for k≥0, including composite Fermat numbers; input is capped at 200 characters.

Description

A Fermat number has the form 2^(2^k)+1.

A Fermat number has the form 2^(2^k)+1. Some such numbers are composite, so testing the form does not test primality.1

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

When to use Fermat Number Checker

Use this for the following task: Check whether a nonnegative decimal integer has the form 2^(2^k)+1 for k≥0, including composite Fermat numbers; input is capped at 200 characters. Use the input and output conventions below to reproduce the intended mathematical quantity.

How to use Fermat Number 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 n according to the field table, then run the tool.
  3. Read isFermat. 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
nNonnegative decimal integerstring (integer/arbitrary); maximum text length 200; pattern ^(0|[1-9][0-9]*)$Required

Parse the nonnegative decimal input with BigInt. Exclude n<3, use a bit test for the first power of two, and test its binary-width-derived exponent similarly.

Fermat ⇔ n−1 is a power of two whose positive exponent is also a power of two

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

Output fieldMeaningValue type
isFermatWhether n is a Fermat numberboolean
json
{
  "input": {
    "n": "4294967297"
  },
  "output": {
    "isFermat": true
  }
}

Limitations and assumptions

The input is capped at 200 characters. Composite Fermat numbers qualify, and the zero exponent is excluded.

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 Proth Number Checker when you need its operation: Check whether a decimal integer is k·2^m+1 with m≥1 and positive odd k<2^m, without requiring primality; input is capped at 200 characters. Choose Woodall Number Checker for the complementary operation: Check whether a nonnegative decimal integer has the form k·2^k−1 for k≥1, without requiring primality; input is capped at 200 characters.

Background reference: OEIS A000215.

References

  1. OEIS A000215 — OEIS Foundation

Similar or alternative tools

  • Proth Number Checker

    Check whether a decimal integer is k·2^m+1 with m≥1 and positive odd k<2^m, without requiring primality; input is capped at 200 characters.

  • Woodall Number Checker

    Check whether a nonnegative decimal integer has the form k·2^k−1 for k≥1, without requiring primality; input is capped at 200 characters.

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