Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Find the nth Fermat number that is also a prime number
| ResourceFunction["FermatPrime"][n] returns the nth Fermat number that is prime. | 
Find the third Fermat prime:
| In[1]:= | ![ResourceFunction["FermatPrime"][3]](https://www.wolframcloud.com/obj/resourcesystem/images/029/02909d82-8bfb-48b5-8b2d-de091a0a1bf6/1-0-0/50670381e2672745.png) | 
| Out[1]= |  | 
Find all known Fermat primes:
| In[2]:= | ![ResourceFunction["FermatPrime"] /@ Range[5]](https://www.wolframcloud.com/obj/resourcesystem/images/029/02909d82-8bfb-48b5-8b2d-de091a0a1bf6/1-0-0/7bc4d1d741053046.png) | 
| Out[2]= |  | 
There are only five known Fermat primes. Therefore, FermatPrime[n] will return unevaluated for n>5:
| In[3]:= | ![ResourceFunction["FermatPrime"][6]](https://www.wolframcloud.com/obj/resourcesystem/images/029/02909d82-8bfb-48b5-8b2d-de091a0a1bf6/1-0-0/61d3f0431584ce6e.png) | 
| Out[3]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License