Given a number n, print the nth prime Fermat number, where the Fermat numbers are of the form 22k+1. This code should theoretically work for any n (i.e. don't hardcode it), although it is not expected to terminate for n > 4. (It should not return 4294967297 for n=5, as 4294967297 is not a prime number.)
Do note that while all Fermat primes are of the form 22n+1, not all numbers of the form 22n+1 are prime. The goal of this challenge is to return the n-th prime.
0 -> 3 1 -> 5 2 -> 17 3 -> 257 4 -> 65537
- Standard loopholes are disallowed.
- 0-indexing and 1-indexing are both acceptable.
- This is code-golf, lowest byte-count wins.
Related: Constructible n-gons