A number of the form 2x + 1 (where x > 0) is prime if and only if x is a power of 2, i.e., x = 2n. So overall number becomes 22n + 1. Such numbers are called Fermat Number (Numbers of form 22n + 1). The first few Fermet numbers are 3, 5, 17, 257, 65537, 4294967297, ….
An important thing to note is a number of the form 22n + 1) is not always prime. For example 225 + 1 = 25 + 1 = 232 + 1 = 4294967297 = 641 * 6700417.
This fact is contributed by Shivam Pradhan (anuj_charm). If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- GFact 23 | (Brocard’s problem)
- Sum of each element raised to (prime-1) % prime
- Print all numbers whose set of prime factors is a subset of the set of the prime factors of X
- Sexy Prime
- Prime Factor
- N-th prime factor of a given number
- Chen Prime Number
- Prime numbers and Fibonacci
- N expressed as sum of 4 prime numbers
- Check if N is a Factorial Prime
- Check if N is Strong Prime
- Find First element in AP which is multiple of given prime
- Check whether N is a Dihedral Prime Number or not
- Check if a number is a Pythagorean Prime or not
- Check if a number is Quartan Prime or not