Wolfram Research

Function Repository Resource:

FermatPrime (1.0.0) current version: 2.0.0 »

Source Notebook

Find the nth Fermat number that is also a prime number

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["FermatPrime"][n]

returns the nth Fermat number that is prime.

Details and Options

A Fermat number is a number of the form 22n+1.

Examples

Basic Examples (2) 

Find the third Fermat prime:

In[1]:=
ResourceFunction["FermatPrime"][3]
Out[1]=

Find all known Fermat primes:

In[2]:=
ResourceFunction["FermatPrime"] /@ Range[5]
Out[2]=

Possible Issues (1) 

There are only five known Fermat primes. Therefore, FermatPrime[n] will return unevaluated for n>5:

In[3]:=
ResourceFunction["FermatPrime"][6]
Out[3]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 2.0.0 – 23 March 2023
  • 1.0.0 – 10 April 2020

Related Resources

License Information